WPILibC++ 2025.2.1
Loading...
Searching...
No Matches
format.h File Reference
#include "base.h"
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <limits>
#include <new>
#include <stdexcept>
#include <string>
#include <system_error>

Go to the source code of this file.

Classes

struct  std::iterator_traits< fmt::basic_appender< T > >
 
struct  is_contiguous< std::basic_string< Char, Traits, Allocator > >
 
struct  detail::std_string_view< T >
 
struct  detail::string_literal< Char, C >
 
class  detail::uint128_fallback
 
struct  detail::is_integral< T >
 
struct  detail::is_integral< int128_opt >
 
struct  detail::is_integral< uint128_t >
 
struct  detail::float128
 
class  basic_memory_buffer< T, SIZE, Allocator >
 A dynamically growing memory buffer for trivially copyable/constructible types with the first SIZE elements stored in the object itself. More...
 
class  writer
 
class  string_buffer
 
struct  is_contiguous< basic_memory_buffer< T, SIZE, Allocator > >
 
struct  detail::fixed_string< Char, N >
 
struct  detail::thousands_sep_result< Char >
 
class  detail::utf8_to_utf16
 
class  detail::to_utf8< WChar, Buffer >
 
struct  detail::dragonbox::float_info< float >
 
struct  detail::dragonbox::float_info< double >
 
struct  detail::dragonbox::float_info< T, enable_if_t< std::numeric_limits< T >::digits==64||std::numeric_limits< T >::digits==113||is_float128< T >::value > >
 
struct  detail::dragonbox::float_info< T, enable_if_t< is_double_double< T >::value > >
 
struct  detail::dragonbox::decimal_fp< T >
 
struct  detail::basic_fp< F >
 
struct  detail::find_escape_result< Char >
 
class  detail::digit_grouping< Char >
 
struct  detail::write_int_arg< UInt >
 
struct  detail::loc_writer< Char >
 
struct  detail::size_padding
 
struct  detail::big_decimal_fp
 
class  detail::fallback_digit_grouping< Char >
 
struct  detail::has_isfinite< T, Enable >
 
struct  detail::has_isfinite< T, enable_if_t< sizeof(std::isfinite(T())) !=0 > >
 
class  detail::bigint
 
struct  detail::default_arg_formatter< Char >
 
struct  detail::arg_formatter< Char >
 
struct  detail::dynamic_spec_getter
 
struct  detail::udl_arg< Char >
 
struct  detail::format_handler< Char >
 
struct  detail::vformat_args< Char >
 
struct  detail::vformat_args< char >
 
class  generic_context< OutputIt, Char >
 
class  loc_value
 
class  format_facet< Locale >
 
struct  formatter< Char[N], Char >
 
class  formatter< std::basic_string< Char, Traits, Allocator >, Char >
 
struct  formatter< detail::bitint< N >, Char >
 
struct  formatter< detail::ubitint< N >, Char >
 
struct  formatter< detail::float128, Char >
 
struct  formatter< T, Char, void_t< detail::format_as_result< T > > >
 
struct  bytes
 
struct  formatter< bytes >
 
struct  group_digits_view< T >
 
struct  formatter< group_digits_view< T > >
 
struct  nested_view< T, Char >
 
struct  formatter< nested_view< T, Char >, Char >
 
struct  nested_formatter< T, Char >
 
class  format_int
 A fast integer formatter. More...
 

Namespaces

namespace  std
 Implement std::hash so that hash_code can be used in STL containers.
 
namespace  detail
 detail namespace with internal helper functions
 
namespace  detail::dragonbox
 
namespace  enums
 
namespace  literals
 

Macros

#define _LIBCPP_REMOVE_TRANSITIVE_INCLUDES
 
#define FMT_REMOVE_TRANSITIVE_INCLUDES
 
#define FMT_USE_NONTYPE_TEMPLATE_ARGS   0
 
#define FMT_INLINE_VARIABLE
 
#define FMT_USE_RTTI   0
 
#define FMT_SO_VISIBILITY(value)
 
#define FMT_NOINLINE
 
#define FMT_THROW(x)
 
#define FMT_NO_UNIQUE_ADDRESS
 
#define FMT_REDUCE_INT_INSTANTIATIONS   0
 
#define FMT_USE_FLOAT128   0
 
#define FMT_USE_FULL_CACHE_DRAGONBOX   0
 
#define FMT_POWERS_OF_10(factor)
 
#define FMT_FORMAT_AS(Type, Base)
 
#define FMT_STRING_IMPL(s, base)
 
#define FMT_STRING(s)
 Constructs a legacy compile-time format string from a string literal s.
 

Typedefs

using detail::uint128_t = conditional_t<FMT_USE_INT128, uint128_opt, uint128_fallback>
 
using detail::uintptr_t = uint128_t
 
template<typename OutputIt >
using detail::reserve_iterator
 
template<typename T >
using detail::is_signed
 
template<typename T >
using detail::is_integer
 
template<typename T >
using detail::is_float128 = std::is_same<T, float128>
 
template<typename T >
using detail::is_floating_point
 
using memory_buffer = basic_memory_buffer<char>
 
template<typename T >
using detail::uint32_or_64_or_128_t
 
template<typename T >
using detail::uint64_or_128_t = conditional_t<num_bits<T>() <= 64, uint64_t, uint128_t>
 
using detail::fp = basic_fp<unsigned long long>
 
template<typename T , bool doublish = num_bits<T>() == num_bits<double>()>
using detail::convert_float_result
 
template<typename T >
using detail::is_builtin
 
using detail::format_func = void (*)(detail::buffer<char>&, int, const char*)
 

Enumerations

enum  { inline_buffer_size = 500 }
 
enum class  detail::to_utf8_error_policy { detail::abort , detail::replace }
 
enum  detail::dragon { detail::predecessor_closer = 1 , detail::fixup = 2 , detail::fixed = 4 }
 

Functions

FMT_CONSTEXPR void detail::abort_fuzzing_if (bool condition)
 
template<typename To , typename From , FMT_ENABLE_IF(sizeof(To)==sizeof(From)) >
FMT_CONSTEXPR20 auto detail::bit_cast (const From &from) -> To
 
auto detail::is_big_endian () -> bool
 
template<typename T >
constexpr auto detail::max_value () -> T
 
template<typename T >
constexpr auto detail::num_bits () -> int
 
template<>
constexpr auto detail::num_bits< int128_opt > () -> int
 
template<>
constexpr auto detail::num_bits< uint128_opt > () -> int
 
template<>
constexpr auto detail::num_bits< uint128_fallback > () -> int
 
template<typename To , typename From , FMT_ENABLE_IF(sizeof(To) > sizeof(From)) >
auto detail::bit_cast (const From &from) -> To
 
template<typename UInt >
FMT_CONSTEXPR20 auto detail::countl_zero_fallback (UInt n) -> int
 
FMT_CONSTEXPR20 auto detail::countl_zero (uint32_t n) -> int
 
FMT_CONSTEXPR20 auto detail::countl_zero (uint64_t n) -> int
 
FMT_INLINE void detail::assume (bool condition)
 
template<typename OutputIt , FMT_ENABLE_IF(is_back_insert_iterator< OutputIt >::value && is_contiguous< typename OutputIt::container >::value) >
FMT_CONSTEXPR20 auto detail::reserve (OutputIt it, size_t n) -> typename OutputIt::value_type *
 
template<typename T >
FMT_CONSTEXPR20 auto detail::reserve (basic_appender< T > it, size_t n) -> basic_appender< T >
 
template<typename Iterator >
constexpr auto detail::reserve (Iterator &it, size_t) -> Iterator &
 
template<typename T , typename OutputIt >
constexpr auto detail::to_pointer (OutputIt, size_t) -> T *
 
template<typename T >
FMT_CONSTEXPR20 auto detail::to_pointer (basic_appender< T > it, size_t n) -> T *
 
template<typename OutputIt , FMT_ENABLE_IF(is_back_insert_iterator< OutputIt >::value && is_contiguous< typename OutputIt::container >::value) >
auto detail::base_iterator (OutputIt it, typename OutputIt::container_type::value_type *) -> OutputIt
 
template<typename Iterator >
constexpr auto detail::base_iterator (Iterator, Iterator it) -> Iterator
 
template<typename OutputIt , typename Size , typename T >
FMT_CONSTEXPR auto detail::fill_n (OutputIt out, Size count, const T &value) -> OutputIt
 
template<typename T , typename Size >
FMT_CONSTEXPR20 auto detail::fill_n (T *out, Size count, char value) -> T *
 
template<typename OutChar , typename InputIt , typename OutputIt >
FMT_CONSTEXPR FMT_NOINLINE auto detail::copy_noinline (InputIt begin, InputIt end, OutputIt out) -> OutputIt
 
FMT_CONSTEXPR auto detail::utf8_decode (const char *s, uint32_t *c, int *e) -> const char *
 
template<typename F >
FMT_CONSTEXPR void detail::for_each_codepoint (string_view s, F f)
 
template<typename Char >
auto detail::compute_width (basic_string_view< Char > s) -> size_t
 
FMT_CONSTEXPR auto detail::compute_width (string_view s) -> size_t
 
template<typename Char >
auto detail::code_point_index (basic_string_view< Char > s, size_t n) -> size_t
 
auto detail::code_point_index (string_view s, size_t n) -> size_t
 
template<size_t SIZE>
FMT_NODISCARD auto to_string (const basic_memory_buffer< char, SIZE > &buf) -> std::string
 
FMT_API auto detail::write_console (int fd, string_view text) -> bool
 
FMT_API void detail::print (FILE *, string_view)
 
template<typename Char , size_t N>
FMT_EXPORT constexpr auto detail::compile_string_to_view (const Char(&s)[N]) -> basic_string_view< Char >
 
template<typename Char >
FMT_EXPORT constexpr auto detail::compile_string_to_view (basic_string_view< Char > s) -> basic_string_view< Char >
 
template<typename T , FMT_ENABLE_IF(is_signed< T >::value) >
constexpr auto detail::is_negative (T value) -> bool
 
auto detail::digits2 (size_t value) -> const char *
 
template<typename Char >
constexpr auto detail::getsign (sign s) -> Char
 
template<typename T >
FMT_CONSTEXPR auto detail::count_digits_fallback (T n) -> int
 
FMT_CONSTEXPR20 auto detail::count_digits (uint64_t n) -> int
 
template<int BITS, typename UInt >
FMT_CONSTEXPR auto detail::count_digits (UInt n) -> int
 
FMT_CONSTEXPR20 auto detail::count_digits (uint32_t n) -> int
 
template<typename Int >
constexpr auto detail::digits10 () noexcept -> int
 
template<>
constexpr auto detail::digits10< int128_opt > () noexcept -> int
 
template<>
constexpr auto detail::digits10< uint128_t > () noexcept -> int
 
template<typename Char >
FMT_API auto detail::thousands_sep_impl (locale_ref loc) -> thousands_sep_result< Char >
 
template<typename Char >
auto detail::thousands_sep (locale_ref loc) -> thousands_sep_result< Char >
 
template<>
auto detail::thousands_sep (locale_ref loc) -> thousands_sep_result< wchar_t >
 
template<typename Char >
FMT_API auto detail::decimal_point_impl (locale_ref loc) -> Char
 
template<typename Char >
auto detail::decimal_point (locale_ref loc) -> Char
 
template<>
auto detail::decimal_point (locale_ref loc) -> wchar_t
 
FMT_BEGIN_EXPORT template FMT_API auto detail::thousands_sep_impl< char > (locale_ref) -> thousands_sep_result< char >
 
template FMT_API auto detail::thousands_sep_impl< wchar_t > (locale_ref) -> thousands_sep_result< wchar_t >
 
template FMT_API auto detail::decimal_point_impl (locale_ref) -> char
 
template<typename Char >
FMT_END_EXPORT auto detail::equal2 (const Char *lhs, const char *rhs) -> bool
 
auto detail::equal2 (const char *lhs, const char *rhs) -> bool
 
template<typename Char >
FMT_CONSTEXPR20 FMT_INLINE void detail::write2digits (Char *out, size_t value)
 
template<typename Char , typename UInt >
FMT_CONSTEXPR20 auto detail::do_format_decimal (Char *out, UInt value, int size) -> Char *
 
template<typename Char , typename UInt >
FMT_CONSTEXPR FMT_INLINE auto detail::format_decimal (Char *out, UInt value, int num_digits) -> Char *
 
template<typename Char , typename UInt , typename OutputIt , FMT_ENABLE_IF(is_back_insert_iterator< OutputIt >::value) >
FMT_CONSTEXPR auto detail::format_decimal (OutputIt out, UInt value, int num_digits) -> OutputIt
 
template<typename Char , typename UInt >
FMT_CONSTEXPR auto detail::do_format_base2e (int base_bits, Char *out, UInt value, int size, bool upper=false) -> Char *
 
template<typename Char , typename UInt >
FMT_CONSTEXPR auto detail::format_base2e (int base_bits, Char *out, UInt value, int num_digits, bool upper=false) -> Char *
 
template<typename Char , typename OutputIt , typename UInt , FMT_ENABLE_IF(is_back_insert_iterator< OutputIt >::value) >
FMT_CONSTEXPR auto detail::format_base2e (int base_bits, OutputIt out, UInt value, int num_digits, bool upper=false) -> OutputIt
 
auto detail::umul128 (uint64_t x, uint64_t y) noexcept -> uint128_fallback
 
auto detail::dragonbox::floor_log10_pow2 (int e) noexcept -> int
 
auto detail::dragonbox::floor_log2_pow10 (int e) noexcept -> int
 
auto detail::dragonbox::umul128_upper64 (uint64_t x, uint64_t y) noexcept -> uint64_t
 
auto detail::dragonbox::umul192_upper128 (uint64_t x, uint128_fallback y) noexcept -> uint128_fallback
 
FMT_API auto detail::dragonbox::get_cached_power (int k) noexcept -> uint128_fallback
 
template<typename T >
FMT_API auto detail::dragonbox::to_decimal (T x) noexcept -> decimal_fp< T >
 
template<typename Float >
constexpr auto detail::has_implicit_bit () -> bool
 
template<typename Float >
constexpr auto detail::num_significand_bits () -> int
 
template<typename Float >
constexpr auto detail::exponent_mask () -> typename dragonbox::float_info< Float >::carrier_uint
 
template<typename Float >
constexpr auto detail::exponent_bias () -> int
 
template<typename Char , typename OutputIt >
FMT_CONSTEXPR auto detail::write_exponent (int exp, OutputIt out) -> OutputIt
 
template<int SHIFT = 0, typename F >
FMT_CONSTEXPR auto detail::normalize (basic_fp< F > value) -> basic_fp< F >
 
FMT_CONSTEXPR auto detail::multiply (uint64_t lhs, uint64_t rhs) -> uint64_t
 
FMT_CONSTEXPR auto detail::operator* (fp x, fp y) -> fp
 
template<typename T >
constexpr auto detail::convert_float (T value) -> convert_float_result< T >
 
template<typename Char , typename OutputIt >
FMT_NOINLINE FMT_CONSTEXPR auto detail::fill (OutputIt it, size_t n, const basic_specs &specs) -> OutputIt
 
template<typename Char , align default_align = align::left, typename OutputIt , typename F >
FMT_CONSTEXPR auto detail::write_padded (OutputIt out, const format_specs &specs, size_t size, size_t width, F &&f) -> OutputIt
 
template<typename Char , align default_align = align::left, typename OutputIt , typename F >
constexpr auto detail::write_padded (OutputIt out, const format_specs &specs, size_t size, F &&f) -> OutputIt
 
template<typename Char , align default_align = align::left, typename OutputIt >
FMT_CONSTEXPR auto detail::write_bytes (OutputIt out, string_view bytes, const format_specs &specs={}) -> OutputIt
 
template<typename Char , typename OutputIt , typename UIntPtr >
auto detail::write_ptr (OutputIt out, UIntPtr value, const format_specs *specs) -> OutputIt
 
FMT_API auto detail::is_printable (uint32_t cp) -> bool
 
auto detail::needs_escape (uint32_t cp) -> bool
 
template<typename Char >
auto detail::find_escape (const Char *begin, const Char *end) -> find_escape_result< Char >
 
auto detail::find_escape (const char *begin, const char *end) -> find_escape_result< char >
 
template<size_t width, typename Char , typename OutputIt >
auto detail::write_codepoint (OutputIt out, char prefix, uint32_t cp) -> OutputIt
 
template<typename OutputIt , typename Char >
auto detail::write_escaped_cp (OutputIt out, const find_escape_result< Char > &escape) -> OutputIt
 
template<typename Char , typename OutputIt >
auto detail::write_escaped_string (OutputIt out, basic_string_view< Char > str) -> OutputIt
 
template<typename Char , typename OutputIt >
auto detail::write_escaped_char (OutputIt out, Char v) -> OutputIt
 
template<typename Char , typename OutputIt >
FMT_CONSTEXPR auto detail::write_char (OutputIt out, Char value, const format_specs &specs) -> OutputIt
 
template<typename Char , typename OutputIt >
FMT_CONSTEXPR auto detail::write (OutputIt out, Char value, const format_specs &specs, locale_ref loc={}) -> OutputIt
 
FMT_CONSTEXPR void detail::prefix_append (unsigned &prefix, unsigned value)
 
template<typename OutputIt , typename UInt , typename Char >
auto detail::write_int (OutputIt out, UInt value, unsigned prefix, const format_specs &specs, const digit_grouping< Char > &grouping) -> OutputIt
 
template<typename OutputIt >
auto detail::write_loc (OutputIt, const loc_value &, const format_specs &, locale_ref) -> bool
 
template<typename T >
FMT_CONSTEXPR auto detail::make_write_int_arg (T value, sign s) -> write_int_arg< uint32_or_64_or_128_t< T > >
 
template<typename Char , typename OutputIt , typename T >
FMT_CONSTEXPR FMT_INLINE auto detail::write_int (OutputIt out, write_int_arg< T > arg, const format_specs &specs) -> OutputIt
 
template<typename Char , typename OutputIt , typename T >
FMT_CONSTEXPR FMT_NOINLINE auto detail::write_int_noinline (OutputIt out, write_int_arg< T > arg, const format_specs &specs) -> OutputIt
 
template<typename Char , typename T , FMT_ENABLE_IF(is_integral< T >::value && !std::is_same< T, bool >::value && !std::is_same< T, Char >::value) >
FMT_CONSTEXPR FMT_INLINE auto detail::write (basic_appender< Char > out, T value, const format_specs &specs, locale_ref loc) -> basic_appender< Char >
 
template<typename Char , typename OutputIt , typename T , FMT_ENABLE_IF(is_integral< T >::value && !std::is_same< T, bool >::value && !std::is_same< T, Char >::value && !std::is_same< OutputIt, basic_appender< Char > >::value) >
FMT_CONSTEXPR FMT_INLINE auto detail::write (OutputIt out, T value, const format_specs &specs, locale_ref loc) -> OutputIt
 
template<typename Char , typename OutputIt >
FMT_CONSTEXPR auto detail::write (OutputIt out, basic_string_view< Char > s, const format_specs &specs) -> OutputIt
 
template<typename Char , typename OutputIt >
FMT_CONSTEXPR auto detail::write (OutputIt out, basic_string_view< Char > s, const format_specs &specs, locale_ref) -> OutputIt
 
template<typename Char , typename OutputIt >
FMT_CONSTEXPR auto detail::write (OutputIt out, const Char *s, const format_specs &specs, locale_ref) -> OutputIt
 
template<typename Char , typename OutputIt , typename T , FMT_ENABLE_IF(is_integral< T >::value && !std::is_same< T, bool >::value && !std::is_same< T, Char >::value) >
FMT_CONSTEXPR auto detail::write (OutputIt out, T value) -> OutputIt
 
template<typename Char >
FMT_CONSTEXPR auto detail::parse_align (const Char *begin, const Char *end, format_specs &specs) -> const Char *
 
template<typename Char , typename OutputIt >
FMT_CONSTEXPR20 auto detail::write_nonfinite (OutputIt out, bool isnan, format_specs specs, sign s) -> OutputIt
 
constexpr auto detail::get_significand_size (const big_decimal_fp &f) -> int
 
template<typename T >
auto detail::get_significand_size (const dragonbox::decimal_fp< T > &f) -> int
 
template<typename Char , typename OutputIt >
constexpr auto detail::write_significand (OutputIt out, const char *significand, int significand_size) -> OutputIt
 
template<typename Char , typename OutputIt , typename UInt >
auto detail::write_significand (OutputIt out, UInt significand, int significand_size) -> OutputIt
 
template<typename Char , typename OutputIt , typename T , typename Grouping >
FMT_CONSTEXPR20 auto detail::write_significand (OutputIt out, T significand, int significand_size, int exponent, const Grouping &grouping) -> OutputIt
 
template<typename Char , typename UInt , FMT_ENABLE_IF(std::is_integral< UInt >::value) >
auto detail::write_significand (Char *out, UInt significand, int significand_size, int integral_size, Char decimal_point) -> Char *
 
template<typename OutputIt , typename UInt , typename Char , FMT_ENABLE_IF(!std::is_pointer< remove_cvref_t< OutputIt > >::value) >
auto detail::write_significand (OutputIt out, UInt significand, int significand_size, int integral_size, Char decimal_point) -> OutputIt
 
template<typename OutputIt , typename Char >
FMT_CONSTEXPR auto detail::write_significand (OutputIt out, const char *significand, int significand_size, int integral_size, Char decimal_point) -> OutputIt
 
template<typename OutputIt , typename Char , typename T , typename Grouping >
FMT_CONSTEXPR20 auto detail::write_significand (OutputIt out, T significand, int significand_size, int integral_size, Char decimal_point, const Grouping &grouping) -> OutputIt
 
template<typename Char , typename OutputIt , typename DecimalFP , typename Grouping = digit_grouping<Char>>
FMT_CONSTEXPR20 auto detail::do_write_float (OutputIt out, const DecimalFP &f, const format_specs &specs, sign s, locale_ref loc) -> OutputIt
 
template<typename Char , typename OutputIt , typename DecimalFP >
FMT_CONSTEXPR20 auto detail::write_float (OutputIt out, const DecimalFP &f, const format_specs &specs, sign s, locale_ref loc) -> OutputIt
 
template<typename T >
constexpr auto detail::isnan (T value) -> bool
 
template<typename T , FMT_ENABLE_IF(std::is_floating_point< T >::value && has_isfinite< T >::value) >
FMT_CONSTEXPR20 auto detail::isfinite (T value) -> bool
 
template<typename T , FMT_ENABLE_IF(!has_isfinite< T >::value) >
FMT_CONSTEXPR auto detail::isfinite (T value) -> bool
 
template<typename T , FMT_ENABLE_IF(is_floating_point< T >::value) >
FMT_INLINE FMT_CONSTEXPR bool detail::signbit (T value)
 
FMT_CONSTEXPR20 void detail::adjust_precision (int &precision, int exp10)
 
FMT_CONSTEXPR20 void detail::format_dragon (basic_fp< uint128_t > value, unsigned flags, int num_digits, buffer< char > &buf, int &exp10)
 
template<typename Float , FMT_ENABLE_IF(!is_double_double< Float >::value) >
FMT_CONSTEXPR20 void detail::format_hexfloat (Float value, format_specs specs, buffer< char > &buf)
 
constexpr auto detail::fractional_part_rounding_thresholds (int index) -> uint32_t
 
template<typename Float >
FMT_CONSTEXPR20 auto detail::format_float (Float value, int precision, const format_specs &specs, bool binary32, buffer< char > &buf) -> int
 
template<typename Char , typename OutputIt , typename T >
FMT_CONSTEXPR20 auto detail::write_float (OutputIt out, T value, format_specs specs, locale_ref loc) -> OutputIt
 
template<typename Char , typename OutputIt , typename T , FMT_ENABLE_IF(is_floating_point< T >::value) >
FMT_CONSTEXPR20 auto detail::write (OutputIt out, T value, format_specs specs, locale_ref loc={}) -> OutputIt
 
template<typename Char , typename OutputIt , typename T , FMT_ENABLE_IF(is_fast_float< T >::value) >
FMT_CONSTEXPR20 auto detail::write (OutputIt out, T value) -> OutputIt
 
template<typename Char , typename OutputIt , typename T , FMT_ENABLE_IF(is_floating_point< T >::value && !is_fast_float< T >::value) >
auto detail::write (OutputIt out, T value) -> OutputIt
 
template<typename Char , typename OutputIt >
auto detail::write (OutputIt out, monostate, format_specs={}, locale_ref={}) -> OutputIt
 
template<typename Char , typename OutputIt >
FMT_CONSTEXPR auto detail::write (OutputIt out, basic_string_view< Char > value) -> OutputIt
 
template<typename Char , typename OutputIt , typename T , FMT_ENABLE_IF(has_to_string_view< T >::value) >
constexpr auto detail::write (OutputIt out, const T &value) -> OutputIt
 
template<typename Char , typename OutputIt , typename T , bool check = std::is_enum<T>::value && !std::is_same<T, Char>::value && mapped_type_constant<T, Char>::value != type::custom_type, FMT_ENABLE_IF(check) >
FMT_CONSTEXPR auto detail::write (OutputIt out, T value) -> OutputIt
 
template<typename Char , typename OutputIt , typename T , FMT_ENABLE_IF(std::is_same< T, bool >::value) >
FMT_CONSTEXPR auto detail::write (OutputIt out, T value, const format_specs &specs={}, locale_ref={}) -> OutputIt
 
template<typename Char , typename OutputIt >
FMT_CONSTEXPR auto detail::write (OutputIt out, Char value) -> OutputIt
 
template<typename Char , typename OutputIt >
FMT_CONSTEXPR20 auto detail::write (OutputIt out, const Char *value) -> OutputIt
 
template<typename Char , typename OutputIt , typename T , FMT_ENABLE_IF(std::is_same< T, void >::value) >
auto detail::write (OutputIt out, const T *value, const format_specs &specs={}, locale_ref={}) -> OutputIt
 
template<typename Char , typename OutputIt , typename T , FMT_ENABLE_IF(mapped_type_constant< T, Char >::value== type::custom_type && !std::is_fundamental< T >::value) >
FMT_CONSTEXPR auto detail::write (OutputIt out, const T &value) -> OutputIt
 
template<typename Context , typename ID >
FMT_CONSTEXPR auto detail::get_arg (Context &ctx, ID id) -> basic_format_arg< Context >
 
template<typename Context >
FMT_CONSTEXPR int detail::get_dynamic_spec (arg_id_kind kind, const arg_ref< typename Context::char_type > &ref, Context &ctx)
 
template<typename Context >
FMT_CONSTEXPR void detail::handle_dynamic_spec (arg_id_kind kind, int &value, const arg_ref< typename Context::char_type > &ref, Context &ctx)
 
FMT_API void detail::do_report_error (format_func func, int error_code, const char *message) noexcept
 
FMT_API void detail::format_error_code (buffer< char > &out, int error_code, string_view message) noexcept
 
template<typename Char >
void detail::vformat_to (buffer< Char > &buf, basic_string_view< Char > fmt, typename vformat_args< Char >::type args, locale_ref loc={})
 
 FMT_FORMAT_AS (signed char, int)
 
 FMT_FORMAT_AS (unsigned char, unsigned)
 
 FMT_FORMAT_AS (short, int)
 
 FMT_FORMAT_AS (unsigned short, unsigned)
 
 FMT_FORMAT_AS (long, detail::long_type)
 
 FMT_FORMAT_AS (unsigned long, detail::ulong_type)
 
 FMT_FORMAT_AS (Char *, const Char *)
 
 FMT_FORMAT_AS (detail::std_string_view< Char >, basic_string_view< Char >)
 
 FMT_FORMAT_AS (std::nullptr_t, const void *)
 
 FMT_FORMAT_AS (void *, const void *)
 
template<typename T >
auto ptr (T p) -> const void *
 Converts p to const void* for pointer formatting.
 
template<typename Enum >
constexpr auto underlying (Enum e) noexcept -> underlying_t< Enum >
 Converts e to the underlying type.
 
template<typename Enum , FMT_ENABLE_IF(std::is_enum< Enum >::value) >
constexpr auto enums::format_as (Enum e) noexcept -> underlying_t< Enum >
 
template<typename T >
auto group_digits (T value) -> group_digits_view< T >
 Returns a view that formats an integer value using ',' as a locale-independent thousands separator.
 
constexpr auto literals::operator""_a (const char *s, size_t) -> detail::udl_arg< char >
 User-defined literal equivalent of fmt::arg.
 
FMT_API auto vsystem_error (int error_code, string_view fmt, format_args args) -> std::system_error
 
template<typename... T>
auto system_error (int error_code, format_string< T... > fmt, T &&... args) -> std::system_error
 Constructs std::system_error with a message formatted with fmt::format(fmt, args...).
 
FMT_API void format_system_error (detail::buffer< char > &out, int error_code, const char *message) noexcept
 Formats an error message for an error returned by an operating system or a language runtime, for example a file opening error, and writes it to out.
 
FMT_API void report_system_error (int error_code, const char *message) noexcept
 
auto vformat (detail::locale_ref loc, string_view fmt, format_args args) -> std::string
 
template<typename... T>
FMT_INLINE auto format (detail::locale_ref loc, format_string< T... > fmt, T &&... args) -> std::string
 
template<typename OutputIt , FMT_ENABLE_IF(detail::is_output_iterator< OutputIt, char >::value) >
auto vformat_to (OutputIt out, detail::locale_ref loc, string_view fmt, format_args args) -> OutputIt
 
template<typename OutputIt , typename... T, FMT_ENABLE_IF(detail::is_output_iterator< OutputIt, char >::value) >
FMT_INLINE auto format_to (OutputIt out, detail::locale_ref loc, format_string< T... > fmt, T &&... args) -> OutputIt
 
template<typename... T>
FMT_NODISCARD FMT_INLINE auto formatted_size (detail::locale_ref loc, format_string< T... > fmt, T &&... args) -> size_t
 
FMT_API auto vformat (string_view fmt, format_args args) -> std::string
 
template<typename... T>
FMT_NODISCARD FMT_INLINE auto format (format_string< T... > fmt, T &&... args) -> std::string
 Formats args according to specifications in fmt and returns the result as a string.
 
template<typename T , FMT_ENABLE_IF(std::is_integral< T >::value) >
FMT_NODISCARD auto to_string (T value) -> std::string
 Converts value to std::string using the default format for type T.
 
template<typename T , FMT_ENABLE_IF(detail::use_format_as< T >::value) >
FMT_NODISCARD auto to_string (const T &value) -> std::string
 

Variables

constexpr FMT_INLINE_VARIABLE uint32_t detail::invalid_code_point = ~uint32_t()
 

Macro Definition Documentation

◆ _LIBCPP_REMOVE_TRANSITIVE_INCLUDES

#define _LIBCPP_REMOVE_TRANSITIVE_INCLUDES

◆ FMT_FORMAT_AS

#define FMT_FORMAT_AS ( Type,
Base )
Value:
template <typename Char> \
struct formatter<Type, Char> : formatter<Base, Char> { \
template <typename FormatContext> \
FMT_CONSTEXPR auto format(Type value, FormatContext& ctx) const \
-> decltype(ctx.out()) { \
return formatter<Base, Char>::format(value, ctx); \
} \
}
FMT_INLINE auto format(detail::locale_ref loc, format_string< T... > fmt, T &&... args) -> std::string
Definition format.h:4146
Definition base.h:651
#define FMT_CONSTEXPR
Definition base.h:113

◆ FMT_INLINE_VARIABLE

#define FMT_INLINE_VARIABLE

◆ FMT_NO_UNIQUE_ADDRESS

#define FMT_NO_UNIQUE_ADDRESS

◆ FMT_NOINLINE

#define FMT_NOINLINE

◆ FMT_POWERS_OF_10

#define FMT_POWERS_OF_10 ( factor)
Value:
factor * 10, (factor) * 100, (factor) * 1000, (factor) * 10000, \
(factor) * 100000, (factor) * 1000000, (factor) * 10000000, \
(factor) * 100000000, (factor) * 1000000000

◆ FMT_REDUCE_INT_INSTANTIATIONS

#define FMT_REDUCE_INT_INSTANTIATIONS   0

◆ FMT_REMOVE_TRANSITIVE_INCLUDES

#define FMT_REMOVE_TRANSITIVE_INCLUDES

◆ FMT_SO_VISIBILITY

#define FMT_SO_VISIBILITY ( value)

◆ FMT_STRING

#define FMT_STRING ( s)
Value:
FMT_STRING_IMPL(s, fmt::detail::compile_string)
#define FMT_STRING_IMPL(s, base)
Definition format.h:4068

Constructs a legacy compile-time format string from a string literal s.

Example:

// A compile-time error because 'd' is an invalid specifier for strings.
std::string s = fmt::format(FMT_STRING("{:d}"), "foo");

◆ FMT_STRING_IMPL

#define FMT_STRING_IMPL ( s,
base )
Value:
[] { \
/* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \
/* Use a macro-like name to avoid shadowing warnings. */ \
struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \
using char_type = fmt::remove_cvref_t<decltype(s[0])>; \
constexpr explicit operator fmt::basic_string_view<char_type>() const { \
return fmt::detail::compile_string_to_view<char_type>(s); \
} \
}; \
using FMT_STRING_VIEW = \
fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \
fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \
return FMT_COMPILE_STRING(); \
}()
#define FMT_VISIBILITY(value)
Definition base.h:215

◆ FMT_THROW

#define FMT_THROW ( x)
Value:
::fmt::detail::assert_fail(__FILE__, __LINE__, (x).what())

◆ FMT_USE_FLOAT128

#define FMT_USE_FLOAT128   0

◆ FMT_USE_FULL_CACHE_DRAGONBOX

#define FMT_USE_FULL_CACHE_DRAGONBOX   0

◆ FMT_USE_NONTYPE_TEMPLATE_ARGS

#define FMT_USE_NONTYPE_TEMPLATE_ARGS   0

◆ FMT_USE_RTTI

#define FMT_USE_RTTI   0

Typedef Documentation

◆ memory_buffer

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
inline_buffer_size 

Function Documentation

◆ FMT_FORMAT_AS() [1/10]

FMT_FORMAT_AS ( Char * ,
const Char *  )

◆ FMT_FORMAT_AS() [2/10]

FMT_FORMAT_AS ( detail::std_string_view< Char > ,
basic_string_view< Char >  )

◆ FMT_FORMAT_AS() [3/10]

FMT_FORMAT_AS ( long ,
detail::long_type  )

◆ FMT_FORMAT_AS() [4/10]

FMT_FORMAT_AS ( short ,
int  )

◆ FMT_FORMAT_AS() [5/10]

FMT_FORMAT_AS ( signed char ,
int  )

◆ FMT_FORMAT_AS() [6/10]

FMT_FORMAT_AS ( std::nullptr_t ,
const void *  )

◆ FMT_FORMAT_AS() [7/10]

FMT_FORMAT_AS ( unsigned char ,
unsigned  )

◆ FMT_FORMAT_AS() [8/10]

FMT_FORMAT_AS ( unsigned long ,
detail::ulong_type  )

◆ FMT_FORMAT_AS() [9/10]

FMT_FORMAT_AS ( unsigned short ,
unsigned  )

◆ FMT_FORMAT_AS() [10/10]

FMT_FORMAT_AS ( void * ,
const void *  )

◆ format() [1/2]

template<typename... T>
FMT_INLINE auto format ( detail::locale_ref loc,
format_string< T... > fmt,
T &&... args ) -> std::string

◆ format() [2/2]

template<typename... T>
FMT_NODISCARD FMT_INLINE auto format ( format_string< T... > fmt,
T &&... args ) -> std::string

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

Example:

#include <fmt/format.h>
std::string message = fmt::format("The answer is {}.", 42);

◆ format_system_error()

FMT_API void format_system_error ( detail::buffer< char > & out,
int error_code,
const char * message )
noexcept

Formats an error message for an error returned by an operating system or a language runtime, for example a file opening error, and writes it to out.

The format is the same as the one used by std::system_error(ec, message) where ec is std::error_code(error_code, std::generic_category()). It is implementation-defined but normally looks like:

<message>: <system-message>

where <message> is the passed message and <system-message> is the system message corresponding to the error code. error_code is a system error code as given by errno.

◆ format_to()

template<typename OutputIt , typename... T, FMT_ENABLE_IF(detail::is_output_iterator< OutputIt, char >::value) >
FMT_INLINE auto format_to ( OutputIt out,
detail::locale_ref loc,
format_string< T... > fmt,
T &&... args ) -> OutputIt

◆ formatted_size()

template<typename... T>
FMT_NODISCARD FMT_INLINE auto formatted_size ( detail::locale_ref loc,
format_string< T... > fmt,
T &&... args ) -> size_t

◆ group_digits()

template<typename T >
auto group_digits ( T value) -> group_digits_view<T>

Returns a view that formats an integer value using ',' as a locale-independent thousands separator.

Example:

fmt::print("{}", fmt::group_digits(12345));
// Output: "12,345"

◆ ptr()

template<typename T >
auto ptr ( T p) -> const void*

Converts p to const void* for pointer formatting.

Example:

auto s = fmt::format("{}", fmt::ptr(p));

◆ report_system_error()

FMT_API void report_system_error ( int error_code,
const char * message )
noexcept

◆ system_error()

template<typename... T>
auto system_error ( int error_code,
format_string< T... > fmt,
T &&... args ) -> std::system_error

Constructs std::system_error with a message formatted with fmt::format(fmt, args...).

error_code is a system error code as given by errno.

Example:

// This throws std::system_error with the description
//   cannot open file 'madeup': No such file or directory
// or similar (system message may vary).
const char* filename = "madeup";
FILE* file = fopen(filename, "r");
if (!file)
  throw fmt::system_error(errno, "cannot open file '{}'", filename);

◆ to_string() [1/3]

template<size_t SIZE>
FMT_NODISCARD auto to_string ( const basic_memory_buffer< char, SIZE > & buf) -> std::string

◆ to_string() [2/3]

template<typename T , FMT_ENABLE_IF(detail::use_format_as< T >::value) >
FMT_NODISCARD auto to_string ( const T & value) -> std::string

◆ to_string() [3/3]

template<typename T , FMT_ENABLE_IF(std::is_integral< T >::value) >
FMT_NODISCARD auto to_string ( T value) -> std::string

Converts value to std::string using the default format for type T.

Example:

std::string answer = fmt::to_string(42);

◆ underlying()

template<typename Enum >
auto underlying ( Enum e) -> underlying_t<Enum>
constexprnoexcept

Converts e to the underlying type.

Example:

enum class color { red, green, blue };
auto s = fmt::format("{}", fmt::underlying(color::red));  // s == "0"

◆ vformat() [1/2]

auto vformat ( detail::locale_ref loc,
string_view fmt,
format_args args ) -> std::string
inline

◆ vformat() [2/2]

FMT_API auto vformat ( string_view fmt,
format_args args ) -> std::string

◆ vformat_to()

template<typename OutputIt , FMT_ENABLE_IF(detail::is_output_iterator< OutputIt, char >::value) >
auto vformat_to ( OutputIt out,
detail::locale_ref loc,
string_view fmt,
format_args args ) -> OutputIt

◆ vsystem_error()

FMT_API auto vsystem_error ( int error_code,
string_view fmt,
format_args args ) -> std::system_error