C++ Utilities
Loading...
Searching...
No Matches
std::formatter< T >

Specialisation of std::formatter for types that have an accessible std::string to_string() const method. More...

#include <formatter.h>

Detailed Description

template<utilities::has_to_string T>
struct std::formatter< T >

Specialisation of std::formatter for types that have an accessible std::string to_string() const method.

Example

struct Whatever {
std::string to_string() const { return "Whatever!"; }
};
Whatever whatever;
auto whatever_str = std::format("{}", whatever);
assert_eq(whatever_str, "Whatever!");
#define assert_eq(lhs, rhs,...)
An assertion macro that checks the equality of two values lhs and rhs. On failure,...
Definition assert.h:114