ORIGINAL
Loading...
Searching...
No Matches
std::formatter< T > Struct Template Reference

std::formatter specialization for printable types More...

#include <printable.h>

Collaboration diagram for std::formatter< T >:
Collaboration graph

Static Public Member Functions

static constexpr auto parse (format_parse_context &ctx)
 Parses the format specification.
 
static auto format (const T &p, format_context &ctx)
 Formats the printable object.
 

Detailed Description

template<typename T>
requires original::ExtendsOf<original::printable, T>
struct std::formatter< T >

std::formatter specialization for printable types

Template Parameters
TType derived from printable

Enables use of printable-derived types with std::format. Uses the toString() method for formatting.

MyClass obj;
auto s = std::format("{}", obj); // "printable(@0x7ffd)"

Member Function Documentation

◆ format()

template<typename T>
auto std::formatter< T >::format ( const T & p,
format_context & ctx )
static

Formats the printable object.

Parameters
pPrintable object to format
ctxFormat context
Returns
Iterator past the formatted output

◆ parse()

template<typename T>
auto std::formatter< T >::parse ( format_parse_context & ctx)
staticconstexpr

Parses the format specification.

Parameters
ctxFormat parse context
Returns
Iterator past the parsed format specification

The documentation for this struct was generated from the following file: