format overloads

Synopses

Declared in <fmt/color.h>

Formats args according to specifications in fmt and returns the result as a string.

template<typename... T>
[[nodiscard]]
std::string
format(
    format_string<T...> fmt,
    T&&... args);

Formats args according to specifications in fmt and returns the result as a std::wstring.

template<typename... T>
std::wstring
format(
    wformat_string<T...> fmt,
    T&&... args);

Formats args according to the compiled format string fmt and returns the result as a string.

template<
    typename S,
    typename... T>
constexpr
std::basic_string<S::char_type>
format(
    S const& fmt,
    T&&... args);

Formats args according to the pre‐compiled format string cf and returns the result as a string.

template<
    typename CompiledFormat,
    typename... T,
    typename Char = CompiledFormat::char_type>
constexpr
std::basic_string<Char>
format(
    CompiledFormat const& cf,
    T const&... args);

Formats args according to specifications in fmt, with an exotic (non‐`char`, non‐`wchar_t`) character type, and returns the result as a string.

template<
    typename S,
    typename... T,
    typename Char = /* implementation-defined */>
std::basic_string<Char>
format(
    S const& fmt,
    T&&... args);

Formats args according to specifications in fmt, using the given locale, and returns the result as a string.

template<typename... T>
std::string
format(
    locale_ref loc,
    format_string<T...> fmt,
    T&&... args);

Formats arguments and returns the result as a string using ANSI escape sequences to specify text formatting.

template<typename... T>
std::string
format(
    text_style ts,
    format_string<T...> fmt,
    T&&... args);

Formats args according to specifications in fmt, applying the text style ts, and returns the result as a std::wstring.

template<typename... T>
std::wstring
format(
    text_style ts,
    wformat_string<T...> fmt,
    T&&... args);

Formats args according to specifications in fmt, using the given locale, with an exotic character type, and returns the result as a string.

template<
    typename S,
    typename... T,
    typename Char = /* implementation-defined */>
std::basic_string<Char>
format(
    locale_ref loc,
    S const& fmt,
    T&&... args);

Return Value

  • The formatted result as a string.

  • The formatted result as a std::wstring.

  • The formatted string.

Parameters

Name

Description

fmt

The format string.

args

The arguments to format.

cf

The pre‐compiled format string.

loc

The locale to use for locale‐specific formatting.

ts

The text style to apply.

Created with MrDocs