tesseract
tesseract copied to clipboard
RFC: Use std::format / fmtlib
This is for 6.0.
See https://github.com/tesseract-ocr/tesseract/pull/3684#issuecomment-999690035
Use std::format when the used STL supports it, fallback to fmtlib otherwise.
MSVC has full support for std::format. Clang has almost complete support. Currently, it is considered experimental, but will likely be stable before we release 6.0.
See branch libfmt for a partial implementation that could also be used for release 5.x.
gcc does not implement it yet. So, possible gcc versions are gcc13 or higher.
I compiled the libfmt
branch with gcc-10 on Debian stable.
https://blog.llvm.org/posts/2022-08-14-libc++-format/
https://www.reddit.com/r/cpp/comments/yugvlf/gcc_13_will_have_format/
https://libcxx.llvm.org/ReleaseNotes/17.html#improvements-and-new-features
The
header is no longer considered experimental. Some std::formatter specializations are not yet available since the class used in the specialization has not been implemented in libc++. This prevents the feature-test macro to be set.
https://github.com/tesseract-ocr/tesseract/tree/libfmt is now based on the latest code from https://github.com/fmtlib/fmt.