fmt
fmt copied to clipboard
A modern formatting library
[First example](https://godbolt.org/z/4WeMdPdj7): ```cpp #include #include #include int main() { std::string line = "a,b-c,d-e,f"; fmt::print("{}\n", line | std::views::split(',')); } ``` With C++20, this prints the expected/desired: ``` [['a'], ['b', '-', 'c'],...
`char`-strings are properly rejected, but the same `wchar_t`-strings are happily compiled. Example: ```C++ #include #include #include #include using namespace std::literals; int main() { fmt::format(L"{:d}", L"I am not a number"); fmt::format(L"{:d}"s,...
According to https://eel.is/c++draft/time.format#tab:time.format.spec, under the `%S` specifier: > If the precision of the input cannot be exactly represented with seconds, then the format is a decimal floating-point number with a...
I noticed `fmt::output_file()` returns a special `fmt::ostream`. It'd be nice if there was something similar for printing to the screen (`cout` stream replacement) / building into a string (`ostringstream` replacement)....
Hi! Here's the problem. Given that `char8_t` is kind of broken currently and still lacks a good standardized transcoding library, we're treating `char` based strings as if they were UTF-8....
Minimal reproducer ([godbolt](https://godbolt.org/z/bxYGbn9cE)): ``` fmt::print("{} {a}", 1, "a"_a = 2); ``` I believe this is supposed to compile, but it causes: ``` on_error("cannot switch from automatic to manual argument indexing");...
With C++20 we can format all the `std::chrono` types using `std::format`, e.g., the following program ``` #include #include #include int main() { std::chrono::utc_time ts = std::chrono::utc_clock::now(); std::cout
My clang-msvc build has a linking issue on `format-test.exe` : ``` [44/60] Linking CXX executable bin\format-test.exe FAILED: bin/format-test.exe cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=test\CMakeFiles\format-test.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100220~1.0\x64\rc.exe --mt=C:\PROGRA~1\LLVM\bin\llvm-mt.exe...
Without `-DFMT_HEADER_ONLY` , this statement ``` fmt::printf("%.*f\n", 15, pi); ``` makes the linking fails in both `clang` v14 and `gcc` v12 [[LIVE](https://compiler-explorer.com/z/MEn4MPq7a)] In `clang-cl` v14, `lld-link` fails as below. ```...
Per discussion in #3081 it might be good to have something similar to `format_as` for ostream before removing `FMT_DEPRECATED_OSTREAM`.