fmt Questions
1
Solved
I have the following bit of code, that uses a runtime determined width:
#include <string>
#include <vector>
#include <fmt/core.h>
#include <fmt/format.h>
int main()
{
std...
1
Solved
Recently I discovered that the following code compiles on a few major compilers, and then throws at runtime:
std::cout << std::format("{:*<{}}", 10, "Hello") << s...
3
Solved
I was trying to use the C++ format utility (std::format). I tried to compile this simple program:
#include <format>
int main()
{
std::cout << std::format("{}, {}", "Hel...
1
Solved
1
std::format has a (compile-time and runtime) format string validation, but one thing not included in this validation is whether there are enough {} placeholders for all arguments (excessive argumen...
1
Solved
Let's say I want to format a single object directly using std::formatter, bypassing std::format. How do I do that?
According to Formatter, I need to call .format(value, format_ctx), where format_ct...
2
Solved
I am trying to format a std::chrono::duration object to the format HH:MM::SS, e.g. 16:42:02 being the hours (16), the minutes (42), and the seconds (2).
the library fmt offers useful formatting spe...
Glittery asked 10/11, 2023 at 17:13
2
Solved
5
Solved
I am new to C++. I am trying to store the current date and time as a string variable.
At this question, I found an answer, and installed the date.h library.
However, when I try to use the code prov...
Foch asked 3/12, 2021 at 2:52
2
Solved
I want to get a timestamp in the format "YYYY-MM-DD hh::mm::ss.fff +zz".
I thought I could do this with the %z specifier for std::format but I'm getting this error on MSVC:
error C7595: '...
1
Solved
I'm able to display the current time using C++ fmt library using std::chrono::system_clock and std::chrono::high_resolution_clock but unable to display time using std::chrono::steady_clock.
Here is...
Botryoidal asked 25/2, 2023 at 11:18
3
Prior to C++ 23, when using std::cout to send output to stdout, there is a distinction between the following two ways of adding a new line at the end of the printed string:
std::cout << &quo...
3
Solved
I would like to remove the reliance of #define macros in my code, and I'm unable to achieve the same functionality with constexpr.
To be practical, consider the following example:
#define PRODUCT_N...
Planetary asked 24/1, 2023 at 2:3
1
I am using fmt::format from the fmtlib extensively. After updating Visual Studio 2022 from 17.3.5 to 17.4.0 I have a problem in Release Builds with Code like the following:
const std::string s1 = f...
Adrienneadrift asked 11/11, 2022 at 13:12
5
Solved
3
Solved
I used to be able to pass Eigen3 arrays/matrices to spdlog, which internally uses libfmt. Starting with libfmt 9.0.0, these types are no longer formatted by libfmt without further code.
Custom type...
1
Solved
An earlier version of the documentation for the C++ {fmt} libary said, about the "chrono format specifiers":
Specifiers that have a calendaric component such as 'd' (the day of month) ar...
Agbogla asked 9/9, 2022 at 3:31
1
Solved
I have lots of classes derived from the same base class, and I'm trying to avoid writing a formatter for all derived classes. I tried to only implement the std::formatter for the base class, but pa...
Silurian asked 22/6, 2022 at 5:58
3
Solved
I have a const std::vector<char> - not null-terminated. I want to print it using the fmt library, without making a copy of the vector.
I would have hoped that specifying the precision would s...
Demibastion asked 5/6, 2022 at 20:18
4
Solved
I'm playing with the great fmt C++ library to format strings more gracefully.
And I'd like to pass a non-variable arguments list to fmt::format. It could be a std::vector, or std::string, or whate...
Armin asked 19/2, 2018 at 23:2
2
Solved
I've been trying to use the std::format function included in C++20. As far as I can tell, clang 14 is supposed to support this feature, but for some reason I am receiving the following error: no me...
1
Solved
I would like to use the fmt library to create a string_view from my format args. There is plenty documented about passing in a compile-time string as the format string, however, I want to output a ...
Glove asked 22/2, 2022 at 13:25
1
Solved
While answering this question about printing a 2D array of strings into a table, I realized:
I haven't found a better way to determine the length of the result of a fmt::format call that to actuall...
1
Solved
I have a following buggy program. Logic is nonsense, it is just a toy example.
#include <ranges>
#include <iostream>
#include <fmt/format.h>
#include <fmt/ranges.h>
templat...
2
Solved
I have two broadly related questions.
I want to make a function that forwards the arguments to fmt::format (and later to std::format, when the support increases). Something like this:
#include <...
1 Next >
© 2022 - 2024 — McMap. All rights reserved.