fmt
Loading...
Searching...
No Matches
base.cppm File Reference
module fmt

Core formatting API: format strings, argument storage and the type-erased formatting entry points. More...

#include "fmt/macros.hpp"
#include <cerrno>
#include <climits>
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <version>
import std;

Classes

struct  fmt::Monostate
struct  fmt::detail::IsStdStringLike< T, Enable >
struct  fmt::detail::IsStdStringLike< T, void_t< decltype(std::declval< T >().find_first_of(typename T::value_type(), 0))> >
struct  fmt::detail::IsBackInsertIterator< It, Enable >
struct  fmt::detail::IsBackInsertIterator< It, bool_constant< std::is_same< decltype(adl::invokeBackInserter< typename It::container_type >()), It >::value > >
struct  fmt::detail::IsContiguous< T, Enable >
struct  fmt::detail::IsContiguous< T, void_t< decltype(std::declval< T & >().data()), decltype(std::declval< T & >().size()), decltype(std::declval< T & >().operator[](size_t()))> >
class  fmt::BasicStringView< Char >
struct  fmt::IsContiguous< T >
struct  fmt::Formatter< T, Char, Enable >
struct  fmt::Locking< T, Enable >
class  fmt::BasicSpecs
struct  fmt::FormatSpecs
class  fmt::ParseContext< Char >
class  fmt::LocaleRef
struct  fmt::detail::IsCodeUnit< T >
struct  fmt::detail::IsCodeUnit< char >
struct  fmt::detail::IsCodeUnit< wchar_t >
struct  fmt::detail::IsCodeUnit< char16_t >
struct  fmt::detail::IsCodeUnit< char32_t >
struct  fmt::detail::HasToStringView< T, Enable >
struct  fmt::detail::HasToStringView< T, void_t< decltype(detail::toStringView(std::declval< T >()))> >
struct  fmt::detail::TypeConstant< T, Char >
struct  fmt::detail::View
struct  fmt::detail::IsView< T, Enable >
struct  fmt::detail::IsView< T, bool_constant< sizeof(T) !=0 > >
struct  fmt::detail::IsNamedArg< T >
struct  fmt::detail::IsStaticNamedArg< T >
struct  fmt::detail::IsNamedArg< NamedArg< T, Char > >
struct  fmt::detail::NamedArg< T, Char >
struct  fmt::detail::NamedArgInfo< Char >
struct  fmt::detail::UseFormatAs< T, Enable >
struct  fmt::detail::UseFormatAsMember< T, Enable >
struct  fmt::detail::UseFormatAs< T, bool_constant< std::is_arithmetic< FormatAsResult< T > >::value > >
struct  fmt::detail::UseFormatAsMember< T, bool_constant< std::is_arithmetic< FormatAsMemberResult< T > >::value > >
struct  fmt::detail::TypeMapper< Char >
class  fmt::detail::CompileParseContext< Char >
union  fmt::detail::arg_ref< Char >
struct  fmt::detail::DynamicFormatSpecs< Char >
struct  fmt::detail::DynamicSpecHandler< Char >
struct  fmt::detail::ParseDynamicSpecResult< Char >
struct  fmt::detail::CompileString
struct  fmt::detail::ArgPack< T >
class  fmt::detail::FormatStringChecker< Char, NUM_ARGS, NUM_NAMED_ARGS, DYNAMIC_NAMES >
class  fmt::detail::Buffer< T >
struct  fmt::detail::BufferTraits
class  fmt::detail::FixedBufferTraits
struct  fmt::detail::HasAppend< OutputIt, InputIt, typename >
struct  fmt::detail::HasAppend< OutputIt, InputIt, void_t< decltype(getContainer(std::declval< OutputIt >()) .append(std::declval< InputIt >(), std::declval< InputIt >()))> >
struct  fmt::detail::HasInsert< OutputIt, T, typename >
struct  fmt::detail::HasInsert< OutputIt, T, void_t< decltype(getContainer(std::declval< OutputIt >()) .insert({}, std::declval< T >(), std::declval< T >()))> >
class  fmt::detail::IteratorBuffer< OutputIt, T, Traits >
class  fmt::detail::IteratorBuffer< T *, T, FixedBufferTraits >
class  fmt::detail::IteratorBuffer< T *, T >
class  fmt::detail::ContainerBuffer< Container >
class  fmt::detail::IteratorBuffer< OutputIt, enable_if_t< IsBackInsertIterator< OutputIt >::value &&IsContiguous< typename OutputIt::container_type >::value, typename OutputIt::container_type::value_type > >
class  fmt::detail::CountingBuffer< T >
struct  fmt::detail::IsBackInsertIterator< BasicAppender< T > >
struct  fmt::detail::IsBufferAppender< It, Enable >
struct  fmt::detail::IsBufferAppender< It, bool_constant< IsBackInsertIterator< It >::value &&std::is_base_of< Buffer< typename It::container_type::value_type >, typename It::container_type >::value > >
struct  fmt::detail::StringValue< Char >
struct  fmt::detail::CustomValue< Context >
struct  fmt::detail::NamedArgValue< Char >
struct  fmt::detail::CustomTag
class  fmt::detail::Value< Context >
struct  fmt::detail::IsOutputIterator< It, T, Enable >
struct  fmt::detail::IsOutputIterator< Appender, char >
struct  fmt::detail::IsOutputIterator< It, T, enable_if_t< std::is_assignable< decltype(*std::declval< decay_t< It > & >()++), T >::value > >
struct  fmt::detail::NamedArgStore< Context, NUM_ARGS, NUM_NAMED_ARGS, DESC >
struct  fmt::detail::FormatArgStore< Context, NUM_ARGS, NUM_NAMED_ARGS, DESC >
struct  fmt::detail::NativeFormatter< T, Char, TYPE >
class  fmt::BasicAppender< T >
class  fmt::BasicFormatArg< Context >
class  fmt::BasicFormatArg< Context >::Handle
class  fmt::BasicFormatArgs< Context >
class  fmt::Context
struct  fmt::RuntimeFormatString< Char >
struct  fmt::Fstring< T >
struct  fmt::Formatter< T, Char, enable_if_t< detail::TypeConstant< T, Char >::value !=detail::Type::kCustomType > >
struct  fmt::FormatToNResult< OutputIt >
struct  fmt::FormatToResult

Typedefs

template<bool B, typename T = void>
using fmt::enable_if_t = typename std::enable_if<B, T>::type
template<bool B, typename T, typename F>
using fmt::conditional_t = typename std::conditional<B, T, F>::type
template<bool B>
using fmt::bool_constant = std::integral_constant<bool, B>
template<typename T>
using fmt::remove_reference_t = typename std::remove_reference<T>::type
template<typename T>
using fmt::remove_const_t = typename std::remove_const<T>::type
template<typename T>
using fmt::remove_cvref_t = typename std::remove_cv<remove_reference_t<T>>::type
template<typename T>
using fmt::make_unsigned_t = typename std::make_unsigned<T>::type
template<typename T>
using fmt::underlying_t = typename std::underlying_type<T>::type
template<typename T>
using fmt::decay_t = typename std::decay<T>::type
using fmt::nullptr_t = decltype(nullptr)
using fmt::Ullong = unsigned long long
template<typename...>
using fmt::void_t = void
template<typename Char>
using fmt::detail::UnsignedChar
using fmt::StringView = BasicStringView<char>
using fmt::Appender = BasicAppender<char>
template<typename Char>
using fmt::BasicFormatParseContext = ParseContext<Char>
using fmt::FormatParseContext = ParseContext<char>
template<typename OutputIt, typename Char>
using fmt::BasicFormatContext
using fmt::FormatContext = Context
template<typename Char>
using fmt::BufferedContext
using fmt::FormatArgs = BasicFormatArgs<Context>
template<typename S, typename V = decltype(detail::toStringView(std::declval<S>()))>
using fmt::detail::char_t = typename V::value_type
using fmt::detail::LongType = conditional_t<kLongShort, int, long long>
using fmt::detail::UlongType = conditional_t<kLongShort, unsigned, Ullong>
template<typename T>
using fmt::detail::FormatAsResult
template<typename T>
using fmt::detail::FormatAsMemberResult
template<typename T, typename U = remove_const_t<T>>
using fmt::detail::UseFormatter
template<typename T, typename Char>
using fmt::detail::mapped_t
template<typename T, typename Char = char>
using fmt::detail::MappedTypeConstant = TypeConstant<mapped_t<T, Char>, Char>
template<typename T, typename Context, Type TYPE = MappedTypeConstant<T, typename Context::char_type>::value>
using fmt::detail::StoredTypeConstant
template<typename Context, int NUM_ARGS>
using fmt::detail::arg_t
template<typename T, typename Char = char>
using fmt::NamedArg = detail::NamedArg<T, Char>
template<typename... T>
using fmt::FormatString = typename Fstring<T...>::t
template<typename T, typename Char = char>
using fmt::IsFormattable
template<typename... T>
using fmt::Vargs

Enumerations

enum class  NativeInt128 : long long
enum class  NativeUint128 : unsigned long long
enum class  fmt::PresentationType : unsigned char {
  kNone = 0 , kDebug = 1 , kString = 2 , kDec = 3 ,
  kHex = 4 , kOct = 5 , kBin = 6 , kChr = 7 ,
  kPointer = 3 , kExp = 1 , kFixed = 2 , kGeneral = 3 ,
  kHexfloat = 4
}
enum class  fmt::Align : int {
  kNone = 0 , kLeft = 1 , kRight = 2 , kCenter = 3 ,
  kNumeric = 4
}
enum class  fmt::Sign : int { kNone = 0 , kMinus = 1 , kPlus = 2 , kSpace = 3 }
enum class  fmt::ArgIdKind : int { kNone = 0 , kIndex = 1 , kName = 2 }
enum class  Type : int {
  kNoneType = 0 , kIntType = 1 , kUintType = 2 , kLongLongType = 3 ,
  kUlongLongType = 4 , kInt128Type = 5 , kUint128Type = 6 , kBoolType = 7 ,
  kCharType = 8 , kLastIntegerType = kCharType , kFloatType = 9 , kDoubleType = 10 ,
  kLongDoubleType = 11 , kLastNumericType = kLongDoubleType , kCstringType = 12 , kStringType = 13 ,
  kPointerType = 14 , kCustomType = 15
}
enum class  State : int {
  kStart = 0 , kAlign = 1 , kSign = 2 , kHash = 3 ,
  kZero = 4 , kWidth = 5 , kPrecision = 6 , kLocale = 7
}

Functions

template<typename T>
constexpr auto fmt::minOf (T a, T b) -> T
template<typename T>
constexpr auto fmt::maxOf (T a, T b) -> T
void fmt::assertFail (const char *file, int line, const char *message)
template<typename Error>
void fmt::throwError (const Error &e, std::source_location loc=std::source_location::current())
template<typename F>
auto fmt::tryInvoke (F f) noexcept -> bool
template<typename... T>
constexpr void fmt::detail::ignoreUnused (const T &...)
constexpr auto fmt::detail::isConstantEvaluated (bool default_value=false) noexcept -> bool
auto fmt::detail::map (NativeInt128) -> monostate
auto fmt::detail::map (NativeUint128) -> monostate
template<typename Int>
constexpr auto fmt::detail::toUnsigned (Int value) -> make_unsigned_t< Int >
template<typename T>
constexpr auto fmt::detail::narrow (T *) -> char *
constexpr auto fmt::detail::narrow (const char *s) -> const char *
template<typename Char>
constexpr auto fmt::detail::compare (const Char *s1, const Char *s2, size_t n) -> int
template<typename Container>
auto fmt::detail::adl::invokeBackInserter () -> decltype(back_inserter(std::declval< Container & >()))
template<typename OutputIt>
constexpr auto fmt::detail::getContainer (OutputIt it) -> typename OutputIt::container_type &
void fmt::reportError (const char *message)
template<typename Char>
requires (IsCodeUnit<Char>::value)
constexpr auto fmt::detail::toStringView (const Char *s) -> BasicStringView< Char >
template<typename T>
requires (IsStdStringLike<T>::value)
constexpr auto fmt::detail::toStringView (const T &s) -> BasicStringView< typename T::value_type >
template<typename Char>
constexpr auto fmt::detail::toStringView (BasicStringView< Char > s) -> BasicStringView< Char >
template<typename T, typename Char>
constexpr auto fmt::detail::typeOf () -> Type
constexpr auto fmt::detail::isIntegralType (Type t) -> bool
constexpr auto fmt::detail::isArithmeticType (Type t) -> bool
constexpr auto fmt::detail::set (Type rhs) -> int
constexpr auto fmt::detail::in (Type t, int set) -> bool
template<bool B = false>
constexpr auto fmt::detail::count () -> int
template<bool B1, bool B2, bool... Tail>
constexpr auto fmt::detail::count () -> int
template<typename... T>
constexpr auto fmt::detail::countNamedArgs () -> int
template<typename... T>
constexpr auto fmt::detail::countStaticNamedArgs () -> int
template<typename Char>
constexpr auto fmt::detail::checkForDuplicate (NamedArgInfo< Char > *named_args, int named_arg_index, BasicStringView< Char > arg_name) -> void
template<typename Char, typename T>
requires (!IsNamedArg<T>::value)
auto fmt::detail::initNamedArg (NamedArgInfo< Char > *, int &arg_index, int &, const T &) -> void
template<typename Char, typename T>
requires (IsNamedArg<T>::value)
auto fmt::detail::initNamedArg (NamedArgInfo< Char > *named_args, int &arg_index, int &named_arg_index, const T &arg) -> void
template<typename T, typename Char>
requires (!IsStaticNamedArg<T>::value)
constexpr auto fmt::detail::initStaticNamedArg (NamedArgInfo< Char > *, int &arg_index, int &) -> void
template<typename T, typename Char>
requires (IsStaticNamedArg<T>::value)
constexpr auto fmt::detail::initStaticNamedArg (NamedArgInfo< Char > *named_args, int &arg_index, int &named_arg_index) -> void
template<typename Char, typename T, typename U = remove_const_t<T>>
auto fmt::detail::hasFormatterImpl (T *p, BufferedContext< Char > *ctx=nullptr) -> decltype(Formatter< U, Char >().format(*p, *ctx), std::true_type())
template<typename Char>
auto fmt::detail::hasFormatterImpl (...) -> std::false_type
template<typename T, typename Char>
constexpr auto fmt::detail::hasFormatter () -> bool
template<typename Char>
requires (std::is_integral<Char>::value)
constexpr auto fmt::detail::toAscii (Char c) -> char
template<typename Char>
constexpr auto fmt::detail::codePointLength (const Char *begin) -> int
template<typename Char>
constexpr auto fmt::detail::parseNonnegativeInt (const Char *&begin, const Char *end, int error_value) noexcept -> int
constexpr auto fmt::detail::parseAlign (char c) -> Align
template<typename Char>
constexpr auto fmt::detail::isNameStart (Char c) -> bool
template<typename Char, typename Handler>
constexpr auto fmt::detail::parseArgId (const Char *begin, const Char *end, Handler &&handler) -> const Char *
template<typename Char>
constexpr auto fmt::detail::parseDynamicSpec (const Char *begin, const Char *end, int &value, arg_ref< Char > &ref, ParseContext< Char > &ctx) -> ParseDynamicSpecResult< Char >
template<typename Char>
constexpr auto fmt::detail::parseWidth (const Char *begin, const Char *end, FormatSpecs &specs, arg_ref< Char > &width_ref, ParseContext< Char > &ctx) -> const Char *
template<typename Char>
constexpr auto fmt::detail::parsePrecision (const Char *begin, const Char *end, FormatSpecs &specs, arg_ref< Char > &precision_ref, ParseContext< Char > &ctx) -> const Char *
template<typename Char>
constexpr auto fmt::detail::parseFormatSpecs (const Char *begin, const Char *end, DynamicFormatSpecs< Char > &specs, ParseContext< Char > &ctx, Type arg_type) -> const Char *
template<typename Char, typename Handler>
constexpr auto fmt::detail::parseReplacementField (const Char *begin, const Char *end, Handler &&handler) -> const Char *
template<typename Char, typename Handler>
constexpr auto fmt::detail::parseFormatString (BasicStringView< Char > fmt, Handler &&handler) -> void
constexpr auto fmt::detail::checkCharSpecs (const FormatSpecs &specs) -> bool
template<typename T, typename Char>
constexpr auto fmt::detail::invokeParse (ParseContext< Char > &ctx) -> const Char *
template<typename T, typename InputIt, typename OutputIt>
requires (IsBackInsertIterator<OutputIt>::value && HasAppend<OutputIt, InputIt>::value)
constexpr auto fmt::detail::copy (InputIt begin, InputIt end, OutputIt out) -> OutputIt
template<typename T, typename InputIt, typename OutputIt>
requires (IsBackInsertIterator<OutputIt>::value && !HasAppend<OutputIt, InputIt>::value && HasInsert<OutputIt, InputIt>::value)
constexpr auto fmt::detail::copy (InputIt begin, InputIt end, OutputIt out) -> OutputIt
template<typename T, typename InputIt, typename OutputIt>
requires (!IsBackInsertIterator<OutputIt>::value || !(HasAppend<OutputIt, InputIt>::value || HasInsert<OutputIt, InputIt>::value))
constexpr auto fmt::detail::copy (InputIt begin, InputIt end, OutputIt out) -> OutputIt
template<typename T, typename OutputIt>
requires (!IsBufferAppender<OutputIt>::value)
auto fmt::detail::getBuffer (OutputIt out) -> IteratorBuffer< OutputIt, T >
template<typename T, typename OutputIt>
requires (IsBufferAppender<OutputIt>::value)
auto fmt::detail::getBuffer (OutputIt out) -> Buffer< T > &
template<typename Buf, typename OutputIt>
auto fmt::detail::getIterator (Buf &buf, OutputIt) -> decltype(buf.out())
template<typename T, typename OutputIt>
auto fmt::detail::getIterator (Buffer< T > &, OutputIt out) -> OutputIt
template<typename>
constexpr auto fmt::detail::encodeTypes () -> Ullong
template<typename Context, typename First, typename... T>
constexpr auto fmt::detail::encodeTypes () -> Ullong
template<typename Context, typename... T, size_t NUM_ARGS = sizeof...(T)>
constexpr auto fmt::detail::makeDescriptor () -> Ullong
template<bool B>
constexpr auto fmt::detail::enforceCompileChecks () -> bool
template<typename T = int>
constexpr auto fmt::detail::isLocking () -> bool
template<typename T1, typename T2, typename... Tail>
constexpr auto fmt::detail::isLocking () -> bool
auto fmt::detail::vformatTo (Buffer< char > &buf, StringView fmt, FormatArgs args, LocaleRef loc={}) -> void
auto fmt::detail::vprintMojibake (FILE *, StringView, const FormatArgs &, bool) -> void
auto fmt::runtime (StringView s) -> RuntimeFormatString<>
template<typename Context = Context, typename... T, int NUM_ARGS = int(sizeof...(T)), int NUM_NAMED_ARGS = detail::countNamedArgs<T...>(), Ullong DESC = detail::makeDescriptor<Context, T...>()>
constexpr auto fmt::makeFormatArgs (T &... args) -> detail::FormatArgStore< Context, NUM_ARGS, NUM_NAMED_ARGS, DESC >
template<typename T>
auto fmt::arg (const char *name, const T &arg) -> NamedArg< T >
template<typename OutputIt>
requires ( detail::IsOutputIterator<remove_cvref_t<OutputIt>, char>::value)
auto fmt::vformatTo (OutputIt &&out, StringView fmt, FormatArgs args) -> remove_cvref_t< OutputIt >
template<typename OutputIt, typename... T>
requires ( detail::IsOutputIterator<remove_cvref_t<OutputIt>, char>::value)
auto fmt::formatTo (OutputIt &&out, FormatString< T... > fmt, T &&... args) -> remove_cvref_t< OutputIt >
template<typename OutputIt, typename... T>
requires (detail::IsOutputIterator<OutputIt, char>::value)
auto fmt::vformatToN (OutputIt out, size_t n, StringView fmt, FormatArgs args) -> FormatToNResult< OutputIt >
template<typename OutputIt, typename... T>
requires (detail::IsOutputIterator<OutputIt, char>::value)
auto fmt::formatToN (OutputIt out, size_t n, FormatString< T... > fmt, T &&... args) -> FormatToNResult< OutputIt >
template<size_t N>
auto fmt::vformatTo (char(&out)[N], StringView fmt, FormatArgs args) -> FormatToResult
template<size_t N, typename... T>
auto fmt::formatTo (char(&out)[N], FormatString< T... > fmt, T &&... args) -> FormatToResult
template<typename... T>
auto fmt::formattedSize (FormatString< T... > fmt, T &&... args) -> size_t
auto fmt::vprint (StringView fmt, FormatArgs args) -> void
auto fmt::vprint (FILE *f, StringView fmt, FormatArgs args) -> void
auto fmt::vprintln (FILE *f, StringView fmt, FormatArgs args) -> void
auto fmt::vprintBuffered (FILE *f, StringView fmt, FormatArgs args) -> void
template<typename... T>
auto fmt::print (FormatString< T... > fmt, T &&... args) -> void
template<typename... T>
auto fmt::print (FILE *f, FormatString< T... > fmt, T &&... args) -> void
template<typename... T>
auto fmt::println (FILE *f, FormatString< T... > fmt, T &&... args) -> void
template<typename... T>
auto fmt::println (FormatString< T... > fmt, T &&... args) -> void

Variables

constexpr int fmt::kVersion = 120'200
constexpr int fmt::detail::kIsUtf8Enabled = "\u00A7"[1] == '\xA7'
constexpr int fmt::detail::kUseUtf8 = 1
constexpr int fmt::detail::kSintSet
constexpr int fmt::detail::kUintSet
constexpr int fmt::detail::kBoolSet = set(Type::kBoolType)
constexpr int fmt::detail::kCharSet = set(Type::kCharType)
constexpr int fmt::detail::kFloatSet
constexpr int fmt::detail::kStringSet = set(Type::kStringType)
constexpr int fmt::detail::kCstringSet = set(Type::kCstringType)
constexpr int fmt::detail::kPointerSet = set(Type::kPointerType)
constexpr bool fmt::detail::kLongShort
constexpr int fmt::detail::kPackedArgBits = 4
constexpr int fmt::detail::kMaxPackedArgs = 62 / kPackedArgBits
constexpr Ullong fmt::detail::kIsUnpackedBit = 1ULL << 63
constexpr Ullong fmt::detail::kHasNamedArgsBit = 1ULL << 62

Detailed Description

Core formatting API: format strings, argument storage and the type-erased formatting entry points.

Interface partition fmt:base.

Typedef Documentation

◆ Appender

using fmt::Appender = BasicAppender<char>
export

An output iterator that appends to a char buffer.

◆ arg_t

template<typename Context, int NUM_ARGS>
using fmt::detail::arg_t
export
Initial value:
conditional_t<NUM_ARGS <= kMaxPackedArgs,
Definition base.cppm:3249
Definition base.cppm:2760

◆ BasicFormatContext

template<typename OutputIt, typename Char>
using fmt::BasicFormatContext
export
Initial value:
conditional_t<std::is_same<OutputIt, Appender>::value,
Definition base.cppm:3521
Definition format.cppm:5177

◆ BufferedContext

template<typename Char>
using fmt::BufferedContext
export
Initial value:
conditional_t<std::is_same<Char, char>::value,

The formatting context for Char, writing to a buffer.

◆ char_t

template<typename S, typename V = decltype(detail::toStringView(std::declval<S>()))>
using fmt::detail::char_t = typename V::value_type
export

String's character (code unit) type. detail:: is intentional to prevent ADL.

◆ FormatArgs

using fmt::FormatArgs = BasicFormatArgs<Context>
export

A view of formatting arguments, for the type-erased functions.

◆ FormatAsMemberResult

template<typename T>
using fmt::detail::FormatAsMemberResult
export
Initial value:
remove_cvref_t<decltype(Formatter<T>::formatAs(
std::declval<const T&>()))>
Definition base.cppm:529

◆ FormatAsResult

template<typename T>
using fmt::detail::FormatAsResult
export
Initial value:
remove_cvref_t<decltype(formatAs(std::declval<const T&>()))>

◆ FormatContext

using fmt::FormatContext = Context
export

The formatting context passed to Formatter::format.

◆ FormatParseContext

using fmt::FormatParseContext = ParseContext<char>
export

The parsing context passed to Formatter::parse.

◆ FormatString

template<typename... T>
using fmt::FormatString = typename Fstring<T...>::t
export

A format string checked against the argument types T at compile time.

A formatting function taking this as a parameter rejects a mismatched or malformed format string at compile time. Use runtime to opt out.

Template Parameters
Tthe argument types the string is checked against.

◆ IsFormattable

template<typename T, typename Char = char>
using fmt::IsFormattable
export
Initial value:
bool_constant<!std::is_same<
detail::mapped_t<conditional_t<std::is_void<T>::value, int*, T>,
Char>,
void>::value>

Whether T can be formatted, as a bool_constant.

See also
formattable for the concept form.

◆ mapped_t

template<typename T, typename Char>
using fmt::detail::mapped_t
export
Initial value:
decltype(detail::TypeMapper<Char>::map(std::declval<T&>()))

◆ StoredTypeConstant

template<typename T, typename Context, Type TYPE = MappedTypeConstant<T, typename Context::char_type>::value>
using fmt::detail::StoredTypeConstant
export
Initial value:
std::integral_constant<Type,
Context::kBuiltinTypes ||
TYPE == Type::kIntType
? TYPE
: Type::kCustomType>

◆ StringView

using fmt::StringView = BasicStringView<char>
export

A non-owning view of a char string.

◆ UnsignedChar

template<typename Char>
using fmt::detail::UnsignedChar
Initial value:
conditional_t<sizeof(Char) == 1, unsigned char, unsigned>

◆ UseFormatter

template<typename T, typename U = remove_const_t<T>>
using fmt::detail::UseFormatter
export
Initial value:
bool_constant<
(std::is_class<T>::value || std::is_enum<T>::value ||
std::is_union<T>::value || std::is_array<T>::value) &&
Definition base.cppm:1008
Definition base.cppm:1174
Definition base.cppm:1303
Definition base.cppm:1297

◆ Vargs

template<typename... T>
using fmt::Vargs
export
Initial value:
int(sizeof...(T)),
detail::countNamedArgs<T...>(),
detail::makeDescriptor<Context, T...>()>
Definition base.cppm:3097

The argument store type for context, used to pass arguments to the type-erased formatting functions.

Enumeration Type Documentation

◆ Align

enum class fmt::Align : int
exportstrong

The alignment given by <, >, ^ in a format specification.

◆ ArgIdKind

enum class fmt::ArgIdKind : int
exportstrong

How an argument is referred to in a replacement field.

◆ PresentationType

enum class fmt::PresentationType : unsigned char
exportstrong

The presentation type given by the final letter of a format specification, such as x for hexadecimal or e for scientific.

none selects the default presentation for the type.

◆ Sign

enum class fmt::Sign : int
exportstrong

The sign policy given by -, +, in a format specification.

Function Documentation

◆ arg()

template<typename T>
auto fmt::arg ( const char * name,
const T & arg ) -> NamedArg< T >
export

Returns a named argument to be used in a formatting function. It should only be used in a call to a formatting function.

Example:

fmt::print("The answer is {answer}.", fmt::arg("answer", 42));

Named arguments passed with fmt::arg are not supported in compile-time checks, but "answer"_a=42 are compile-time checked in sufficiently new compilers. See operator""_a().

◆ formattedSize()

template<typename... T>
auto fmt::formattedSize ( FormatString< T... > fmt,
T &&... args ) -> size_t
nodiscardexport

Returns the number of chars in the output of format(fmt, args...).

◆ formatTo() [1/2]

template<size_t N, typename... T>
auto fmt::formatTo ( char(&) out[N],
FormatString< T... > fmt,
T &&... args ) -> FormatToResult
export

Formats args into the character array out.

Parameters
outthe destination array, whose size bounds the output.
fmta format string, checked at compile time.
argsthe arguments to format.
Returns
a format_to_result. Converting it to char* reports truncation as an error rather than losing data silently.

Example:

char buf[10];
auto result = fmt::formatTo(buf, "{}", 42);

◆ formatTo() [2/2]

template<typename OutputIt, typename... T>
requires ( detail::IsOutputIterator<remove_cvref_t<OutputIt>, char>::value)
auto fmt::formatTo ( OutputIt && out,
FormatString< T... > fmt,
T &&... args ) -> remove_cvref_t< OutputIt >
export

Formats args according to specifications in fmt, writes the result to the output iterator out and returns the iterator past the end of the output range. format_to does not append a terminating null character.

Example:

auto out = std::vector<char>();
fmt::formatTo(std::back_inserter(out), "{}", 42);

◆ formatToN()

template<typename OutputIt, typename... T>
requires (detail::IsOutputIterator<OutputIt, char>::value)
auto fmt::formatToN ( OutputIt out,
size_t n,
FormatString< T... > fmt,
T &&... args ) -> FormatToNResult< OutputIt >
export

Formats args and writes at most n characters to out.

No terminating null is appended.

Parameters
outan output iterator to write to.
nthe maximum number of characters to write.
fmta format string, checked at compile time.
argsthe arguments to format.
Returns
the iterator past the last character written, and the size the output would have had without truncation.

◆ makeFormatArgs()

template<typename Context = Context, typename... T, int NUM_ARGS = int(sizeof...(T)), int NUM_NAMED_ARGS = detail::countNamedArgs<T...>(), Ullong DESC = detail::makeDescriptor<Context, T...>()>
auto fmt::makeFormatArgs ( T &... args) -> detail::FormatArgStore< Context, NUM_ARGS, NUM_NAMED_ARGS, DESC >
constexprexport

Bundles references to args into a store convertible to FormatArgs.

Arguments are taken by lvalue reference and stored by reference, so they must outlive the store; passing a temporary dangles.

Template Parameters
Contextthe formatting context, Context by default.
Parameters
argsthe arguments to bundle.
Returns
the argument store.
See also
arg for named arguments.

◆ print() [1/2]

template<typename... T>
auto fmt::print ( FILE * f,
FormatString< T... > fmt,
T &&... args ) -> void
export

Formats args according to specifications in fmt and writes the output to the file f.

Example:

fmt::print(stderr, "Don't {}!", "panic");

◆ print() [2/2]

template<typename... T>
auto fmt::print ( FormatString< T... > fmt,
T &&... args ) -> void
export

Formats args according to specifications in fmt and writes the output to stdout.

Example:

fmt::print("The answer is {}.", 42);

◆ println() [1/2]

template<typename... T>
auto fmt::println ( FILE * f,
FormatString< T... > fmt,
T &&... args ) -> void
export

Formats args according to specifications in fmt and writes the output to the file f followed by a newline.

◆ println() [2/2]

template<typename... T>
auto fmt::println ( FormatString< T... > fmt,
T &&... args ) -> void
export

Formats args according to specifications in fmt and writes the output to stdout followed by a newline.

◆ reportError()

auto fmt::reportError ( const char * message)
export

Reports a format error at compile time or, via a format_error exception, at runtime.

◆ runtime()

auto fmt::runtime ( StringView s) -> RuntimeFormatString<>
export

Creates a runtime format string.

Example:

// Check format string at runtime instead of compile-time.
fmt::print(fmt::runtime("{:d}"), "I am not a number");

◆ throwError()

template<typename Error>
void fmt::throwError ( const Error & e,
std::source_location loc = std::source_location::current() )

Throws e, or aborts with its message if exceptions are disabled. This is the single place where the exception mode is decided, so throw sites are ordinary function calls rather than macro invocations.

◆ tryInvoke()

template<typename F>
auto fmt::tryInvoke ( F f) -> bool
noexcept

Invokes f, reporting whether it ran to completion. With exceptions disabled it simply runs and always succeeds. This is the only try block in the library.

◆ vformatTo() [1/2]

template<size_t N>
auto fmt::vformatTo ( char(&) out[N],
StringView fmt,
FormatArgs args ) -> FormatToResult
export
Deprecated
Use format_to with a compile-time checked format string.

◆ vformatTo() [2/2]

template<typename OutputIt>
requires ( detail::IsOutputIterator<remove_cvref_t<OutputIt>, char>::value)
auto fmt::vformatTo ( OutputIt && out,
StringView fmt,
FormatArgs args ) -> remove_cvref_t< OutputIt >
export

Formats a string and writes the output to out.

◆ vformatToN()

template<typename OutputIt, typename... T>
requires (detail::IsOutputIterator<OutputIt, char>::value)
auto fmt::vformatToN ( OutputIt out,
size_t n,
StringView fmt,
FormatArgs args ) -> FormatToNResult< OutputIt >
export

Type-erased form of format_to_n.

◆ vprint() [1/2]

auto fmt::vprint ( FILE * f,
StringView fmt,
FormatArgs args ) -> void
export

Type-erased form of print to a stream.

◆ vprint() [2/2]

auto fmt::vprint ( StringView fmt,
FormatArgs args ) -> void
export

Type-erased form of print to stdout.

◆ vprintBuffered()

auto fmt::vprintBuffered ( FILE * f,
StringView fmt,
FormatArgs args ) -> void
export

Type-erased print that formats into a buffer before writing, for a stream that may be written to concurrently.

◆ vprintln()

auto fmt::vprintln ( FILE * f,
StringView fmt,
FormatArgs args ) -> void
export

Type-erased form of println.

Variable Documentation

◆ kFloatSet

int fmt::detail::kFloatSet
constexprexport
Initial value:
= set(Type::kFloatType) |
set(Type::kDoubleType) |
set(Type::kLongDoubleType)

◆ kLongShort

bool fmt::detail::kLongShort
constexprexport
Initial value:
=
sizeof(long) == sizeof(int) && FMT_BUILTIN_TYPES

◆ kSintSet

int fmt::detail::kSintSet
constexprexport
Initial value:
= set(Type::kIntType) |
set(Type::kLongLongType) |
set(Type::kInt128Type)

◆ kUintSet

int fmt::detail::kUintSet
constexprexport
Initial value:
= set(Type::kUintType) |
set(Type::kUlongLongType) |
set(Type::kUint128Type)