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);
confirm_eq(whatever_str, "Whatever!");
#define confirm_eq(lhs, rhs,...)
An confirmation macro that checks the equality of two values lhs and rhs. On failure,...
Definition confirm.h:114