Skip to main content
Filter by
Sorted by
Tagged with
7 votes
2 answers
421 views

I am trying to come up with a way to determine, whether a given format string is valid for a given Type at compile time. I was expecting for a simple concept to work: template<typename T> ...
Jens's user avatar
  • 213
1 vote
1 answer
190 views

// c++20 #include <iostream> #include <format> #include <winerror.h> // typedef _Return_type_success_(return >= 0) long HRESULT; // #define _HRESULT_TYPEDEF_(_sc) ((HRESULT)_sc) ...
ebmoluoc's user avatar
-1 votes
2 answers
107 views

I have struct/class that formats numbers. I want to tune its formatting parameters how i like. And this means I "need"(could be not, if there's another much more clever way of doing it?): &...
kusok_kvarka's user avatar
1 vote
1 answer
494 views

I'm using spdlog with fmt::format_string to log messages, and I also want to capture the call location using std::source_location. My goal is to have a simple logging function like this: Logger::Error(...
ATOM's user avatar
  • 59
1 vote
0 answers
64 views

I'm working as a side project on a strong physical type class template for C++. And now I'm having a problem in writing a formatter for {fmt} to display the value with the unit string properly. Here ...
dodo's user avatar
  • 29
2 votes
1 answer
147 views

Consider the following snippet: // #define USE_FMTLIB #include <chrono> #include <iostream> #if defined(USE_FMTLIB) #include <fmt/chrono.h> #include <fmt/core.h> #...
ykim's user avatar
  • 137
2 votes
0 answers
170 views

When I write code, I frequently need to print some value to the terminal. I like the new C++23 <print> functionality with which I can write: std::println("{}", value); However, if I ...
Daniel Langr's user avatar
  • 24.2k
3 votes
1 answer
238 views

I am using gcc-13.3 with c++23 enabled. I have the following code which uses std::format to format a std::chrono::year_month_day to a string: #include <chrono> #include <format> #include &...
Steve Lorimer's user avatar
7 votes
1 answer
358 views

I've got a simple code example that attempts to use a format_as() overload to format a custom type (an enum); it outputs a std::string found in a map. From the link above, the compiler is configured ...
Chris Robison's user avatar
0 votes
1 answer
55 views

I’d like to make use of the existing to_string formatters in my code struct A {}; struct B {}; template <typename T> std::string to_string(const T&); template <> std::string ...
abrzozowski's user avatar
1 vote
3 answers
164 views

In my code I use printf-like LOG(const char* fmt, ...) macro. Under the hood it prints/logs to different output destinations (file, console, debugger output). It's my own macro, so it does printf ...
Pavel P's user avatar
  • 17.3k
8 votes
1 answer
586 views

I was trying to produce a simple, fully statically linked binary so that it can easily run on distributions such as Alpine without having to install anything else. In my use case, I'm only using a ...
Tend's user avatar
  • 158
2 votes
1 answer
136 views

Considering the following working example: #include<string> #include<fmt/format.h> class foo_type{}; template<> struct fmt::formatter<foo_type>{ private: std::...
kmft3kte's user avatar
0 votes
2 answers
126 views

I have some protobuf message classes that I would like to be able to print using fmtlib. For example, I have a TaskStatus message where TaskStatus is derived from google::protobuf::Message. I am ...
Glenn Coombs's user avatar
2 votes
2 answers
416 views

I'm trying to define a reusable formatter for a class, let's say cv::Point_ from OpenCV. The code compiles fine on its own but when I use this formatter I get compilation errors. Here is the code: ...
ILikeToLearn's user avatar

15 30 50 per page
1
2 3 4 5
24