Scippy

SoPlex

Sequential object-oriented simPlex

format.h File Reference
#include "core.h"
#include <algorithm>
#include <cerrno>
#include <cmath>
#include <cstdint>
#include <limits>
#include <memory>
#include <stdexcept>
#include "format-inl.h"

Go to the source code of this file.

Classes

struct  fallback_uintptr
 
struct  iterator_category< It, Enable >
 
struct  iterator_category< T * >
 
struct  iterator_category< It, void_t< typename It::iterator_category > >
 
class  is_output_iterator< It >
 
class  counting_iterator
 
struct  counting_iterator::value_type
 
class  truncating_iterator_base< OutputIt >
 
class  truncating_iterator< OutputIt, Enable >
 
class  truncating_iterator< OutputIt, std::false_type >
 
class  truncating_iterator< OutputIt, std::true_type >
 
class  output_range< OutputIt, T >
 
struct  output_range< OutputIt, T >::sentinel
 
class  buffer_range< T >
 
class  u8string_view
 
class  basic_memory_buffer< T, SIZE, Allocator >
 
class  format_error
 
struct  basic_data< T >
 
struct  data
 
struct  null< T >
 
struct  fill_t< Char >
 
struct  basic_format_specs< Char >
 
struct  float_specs
 
class  float_writer< Char >
 
class  int_type_checker< ErrorHandler >
 
class  char_specs_checker< ErrorHandler >
 
class  cstring_type_checker< ErrorHandler >
 
struct  nonfinite_writer< Char >
 
class  basic_writer< Range >
 
struct  basic_writer< Range >::padded_int_writer< F >
 
struct  basic_writer< Range >::int_writer< Int, Specs >
 
struct  basic_writer< Range >::int_writer< Int, Specs >::dec_writer
 
struct  basic_writer< Range >::int_writer< Int, Specs >::hex_writer
 
struct  basic_writer< Range >::int_writer< Int, Specs >::bin_writer< BITS >
 
struct  basic_writer< Range >::int_writer< Int, Specs >::num_writer
 
struct  basic_writer< Range >::str_writer< Char >
 
struct  basic_writer< Range >::pointer_writer< UIntPtr >
 
struct  is_integral< T >
 
struct  is_integral< int128_t >
 
struct  is_integral< uint128_t >
 
class  arg_formatter_base< Range, ErrorHandler >
 
struct  arg_formatter_base< Range, ErrorHandler >::char_writer
 
struct  arg_formatter_base< Range, ErrorHandler >::char_spec_handler
 
struct  arg_formatter_base< Range, ErrorHandler >::cstring_spec_handler
 
class  custom_formatter< Context >
 
class  width_checker< ErrorHandler >
 
class  precision_checker< ErrorHandler >
 
class  specs_setter< Char >
 
class  numeric_specs_checker< ErrorHandler >
 
class  specs_checker< Handler >
 
struct  auto_id
 
class  specs_handler< ParseContext, Context >
 
struct  arg_ref< Char >
 
union  arg_ref< Char >::value
 
struct  dynamic_format_specs< Char >
 
class  dynamic_specs_handler< ParseContext >
 
struct  width_adapter< SpecHandler, Char >
 
struct  precision_adapter< SpecHandler, Char >
 
struct  id_adapter< Handler, Char >
 
class  format_string_checker< Char, ErrorHandler, Args >
 
class  arg_formatter< Range >
 
class  system_error
 
class  format_int
 
struct  formatter< T, Char, enable_if_t< internal::type_constant< T, Char >::value !=internal::custom_type > >
 
struct  formatter< void *, Char >
 
struct  formatter< Char[N], Char >
 
class  dynamic_formatter< Char >
 
struct  dynamic_formatter< Char >::null_handler
 
struct  format_handler< ArgFormatter, Char, Context >
 
struct  arg_join< It, Char >
 
struct  formatter< arg_join< It, Char >, Char >
 
struct  format_to_n_result< OutputIt >
 

Namespaces

 internal
 
 align
 
 sign
 

Macros

#define FMT_CLANG_VERSION   0
 
#define FMT_ICC_VERSION   0
 
#define FMT_CUDA_VERSION   0
 
#define FMT_HAS_BUILTIN(x)   0
 
#define FMT_FALLTHROUGH
 
#define FMT_THROW(x)   throw x
 
#define FMT_USE_USER_DEFINED_LITERALS   0
 
#define FMT_USE_UDL_TEMPLATE   0
 
#define FMT_NUMERIC_ALIGN   1
 
#define FMT_DEPRECATED_PERCENT   0
 
#define FMT_USE_GRISU   1
 
#define FMT_ALWAYS_INLINE
 
#define FMT_USE_WINDOWS_H   0
 
#define FMT_FORMAT_AS(Type, Base)
 
#define FMT_STRING_IMPL(s, ...)
 
#define FMT_STRING(s)   FMT_STRING_IMPL(s, )
 
#define FMT_FUNC
 

Typedefs

using uintptr_t = fallback_uintptr
 
template<typename T >
using iterator_t = decltype(std::begin(std::declval< T & >()))
 
template<typename T >
using checked_ptr = T *
 
template<typename InputIt , typename OutChar >
using needs_conversion = bool_constant< std::is_same< typename std::iterator_traits< InputIt >::value_type, char >::value &&std::is_same< OutChar, char8_t >::value >
 
using memory_buffer = basic_memory_buffer< char >
 
using wmemory_buffer = basic_memory_buffer< wchar_t >
 
template<typename T >
using uint32_or_64_or_128_t = conditional_t< std::numeric_limits< T >::digits<=32, uint32_t, conditional_t< std::numeric_limits< T >::digits<=64, uint64_t, uint128_t > >
 
using align_t = align::type
 
using sign_t = sign::type
 
using format_specs = basic_format_specs< char >
 
using writer = basic_writer< buffer_range< char > >
 
template<typename T >
using is_integer = bool_constant< is_integral< T >::value &&!std::is_same< T, bool >::value &&!std::is_same< T, char >::value &&!std::is_same< T, wchar_t >::value >
 
using FMT_DEPRECATED_ALIAS = internal::basic_writer< Range >
 
template<typename OutputIt , typename Char = char>
using format_context_t = basic_format_context< OutputIt, Char >
 
template<typename OutputIt , typename Char = char>
using format_args_t = basic_format_args< format_context_t< OutputIt, Char > >
 
template<typename OutputIt , typename Char = typename OutputIt::value_type>
using format_to_n_context = format_context_t< internal::truncating_iterator< OutputIt >, Char >
 
template<typename OutputIt , typename Char = typename OutputIt::value_type>
using format_to_n_args = basic_format_args< format_to_n_context< OutputIt, Char > >
 

Enumerations

enum  { inline_buffer_size = 500 }
 
enum  type {
  none, left, right, center,
  numeric
}
 
enum  type { none, minus, plus, space }
 
enum  float_format : unsigned char { general, exp, fixed, hex }
 
enum  arg_id_kind { none, index, name }
 

Functions

template<typename T >
const_check (T value)
 
template<typename Dest , typename Source >
Dest bit_cast (const Source &source)
 
bool is_big_endian ()
 
fallback_uintptr to_uintptr (const void *p)
 
template<typename T >
constexpr T max_value ()
 
template<typename T >
constexpr int num_bits ()
 
template<>
constexpr int num_bits< fallback_uintptr > ()
 
template<typename Char >
Char * get_data (std::basic_string< Char > &s)
 
template<typename Container >
Container::value_type * get_data (Container &c)
 
template<typename T >
T * make_checked (T *p, std::size_t)
 
template<typename Container , FMT_ENABLE_IF(is_contiguous< Container >::value) >
checked_ptr< typename Container::value_type > reserve (std::back_insert_iterator< Container > &it, std::size_t n)
 
template<typename Iterator >
Iterator & reserve (Iterator &it, std::size_t)
 
template<typename Char >
size_t count_code_points (basic_string_view< Char > s)
 
size_t count_code_points (basic_string_view< char8_t > s)
 
template<typename Char >
size_t code_point_index (basic_string_view< Char > s, size_t n)
 
size_t code_point_index (basic_string_view< char8_t > s, size_t n)
 
char8_t to_char8_t (char c)
 
template<typename OutChar , typename InputIt , typename OutputIt , FMT_ENABLE_IF(!needs_conversion< InputIt, OutChar >::value) >
OutputIt copy_str (InputIt begin, InputIt end, OutputIt it)
 
template<typename T >
constexpr bool use_grisu ()
 
template<typename T , FMT_ENABLE_IF(std::numeric_limits< T >::is_signed) >
FMT_CONSTEXPR bool is_negative (T value)
 
int count_digits (uint64_t n)
 
template<unsigned BITS, typename UInt >
int count_digits (UInt n)
 
template<>
int count_digits< 4 > (internal::fallback_uintptr n)
 
template<typename Char >
FMT_API std::string grouping_impl (locale_ref loc)
 
template<typename Char >
std::string grouping (locale_ref loc)
 
template<>
std::string grouping< wchar_t > (locale_ref loc)
 
template<typename Char >
FMT_API Char thousands_sep_impl (locale_ref loc)
 
template<typename Char >
Char thousands_sep (locale_ref loc)
 
template<>
wchar_t thousands_sep (locale_ref loc)
 
template<typename Char >
FMT_API Char decimal_point_impl (locale_ref loc)
 
template<typename Char >
Char decimal_point (locale_ref loc)
 
template<>
wchar_t decimal_point (locale_ref loc)
 
template<typename UInt , typename Char , typename F >
Char * format_decimal (Char *buffer, UInt value, int num_digits, F add_thousands_sep)
 
template<typename Int >
constexpr int digits10 () noexcept
 
template<>
constexpr int digits10< int128_t > () noexcept
 
template<>
constexpr int digits10< uint128_t > () noexcept
 
template<typename Char , typename UInt , typename Iterator , typename F >
Iterator format_decimal (Iterator out, UInt value, int num_digits, F add_thousands_sep)
 
template<typename Char , typename It , typename UInt >
It format_decimal (It out, UInt value, int num_digits)
 
template<unsigned BASE_BITS, typename Char , typename UInt >
Char * format_uint (Char *buffer, UInt value, int num_digits, bool upper=false)
 
template<unsigned BASE_BITS, typename Char >
Char * format_uint (Char *buffer, internal::fallback_uintptr n, int num_digits, bool=false)
 
template<unsigned BASE_BITS, typename Char , typename It , typename UInt >
It format_uint (It out, UInt value, int num_digits, bool upper=false)
 
template<typename Char , typename It >
It write_exponent (int exp, It it)
 
template<typename T >
int format_float (T value, int precision, float_specs specs, buffer< char > &buf)
 
template<typename T >
int snprintf_float (T value, int precision, float_specs specs, buffer< char > &buf)
 
template<typename T >
promote_float (T value)
 
double promote_float (float value)
 
template<typename Handler >
FMT_CONSTEXPR void handle_int_type_spec (char spec, Handler &&handler)
 
template<typename ErrorHandler = error_handler, typename Char >
FMT_CONSTEXPR float_specs parse_float_type_spec (const basic_format_specs< Char > &specs, ErrorHandler &&eh={})
 
template<typename Char , typename Handler >
FMT_CONSTEXPR void handle_char_specs (const basic_format_specs< Char > *specs, Handler &&handler)
 
template<typename Char , typename Handler >
FMT_CONSTEXPR void handle_cstring_type_spec (Char spec, Handler &&handler)
 
template<typename Char , typename ErrorHandler >
FMT_CONSTEXPR void check_string_type_spec (Char spec, ErrorHandler &&eh)
 
template<typename Char , typename ErrorHandler >
FMT_CONSTEXPR void check_pointer_type_spec (Char spec, ErrorHandler &&eh)
 
template<typename Char >
FMT_CONSTEXPR bool is_name_start (Char c)
 
template<typename Char , typename ErrorHandler >
FMT_CONSTEXPR int parse_nonnegative_int (const Char *&begin, const Char *end, ErrorHandler &&eh)
 
template<template< typename > class Handler, typename FormatArg , typename ErrorHandler >
FMT_CONSTEXPR int get_dynamic_spec (FormatArg arg, ErrorHandler eh)
 
template<typename Context >
FMT_CONSTEXPR Context::format_arg get_arg (Context &ctx, int id)
 
template<typename Char , typename IDHandler >
FMT_CONSTEXPR const Char * parse_arg_id (const Char *begin, const Char *end, IDHandler &&handler)
 
template<typename Char , typename Handler >
FMT_CONSTEXPR const Char * parse_align (const Char *begin, const Char *end, Handler &&handler)
 
template<typename Char , typename Handler >
FMT_CONSTEXPR const Char * parse_width (const Char *begin, const Char *end, Handler &&handler)
 
template<typename Char , typename Handler >
FMT_CONSTEXPR const Char * parse_precision (const Char *begin, const Char *end, Handler &&handler)
 
template<typename Char , typename SpecHandler >
FMT_CONSTEXPR const Char * parse_format_specs (const Char *begin, const Char *end, SpecHandler &&handler)
 
template<bool IS_CONSTEXPR, typename T , typename Ptr = const T*>
FMT_CONSTEXPR bool find (Ptr first, Ptr last, T value, Ptr &out)
 
template<>
bool find< false, char > (const char *first, const char *last, char value, const char *&out)
 
template<bool IS_CONSTEXPR, typename Char , typename Handler >
FMT_CONSTEXPR void parse_format_string (basic_string_view< Char > format_str, Handler &&handler)
 
template<typename T , typename ParseContext >
FMT_CONSTEXPR const ParseContext::char_type * parse_format_specs (ParseContext &ctx)
 
template<typename Char , typename ErrorHandler , typename... Args>
FMT_CONSTEXPR bool do_check_format_string (basic_string_view< Char > s, ErrorHandler eh=ErrorHandler())
 
template<typename... , typename S , FMT_ENABLE_IF(is_compile_string< S >::value) >
void check_format_string (S)
 
template<template< typename > class Handler, typename Context >
void handle_dynamic_spec (int &value, arg_ref< typename Context::char_type > ref, Context &ctx)
 
FMT_API void format_system_error (internal::buffer< char > &out, int error_code, string_view message) FMT_NOEXCEPT
 
FMT_API void report_system_error (int error_code, string_view message) FMT_NOEXCEPT
 
 FMT_FORMAT_AS (signed char, int)
 
 FMT_FORMAT_AS (unsigned char, unsigned)
 
 FMT_FORMAT_AS (short, int)
 
 FMT_FORMAT_AS (long, long long)
 
 FMT_FORMAT_AS (unsigned long, unsigned long long)
 
 FMT_FORMAT_AS (Char *, const Char *)
 
 FMT_FORMAT_AS (std::basic_string< Char >, basic_string_view< Char >)
 
 FMT_FORMAT_AS (std::nullptr_t, const void *)
 
 FMT_FORMAT_AS (internal::std_string_view< Char >, basic_string_view< Char >)
 
template<typename Char , typename ErrorHandler >
FMT_CONSTEXPR void advance_to (basic_format_parse_context< Char, ErrorHandler > &ctx, const Char *p)
 
template<typename ArgFormatter , typename Char , typename Context >
Context::iterator vformat_to (typename ArgFormatter::range out, basic_string_view< Char > format_str, basic_format_args< Context > args, internal::locale_ref loc=internal::locale_ref())
 
template<typename T >
const void * ptr (const T *p)
 
template<typename T >
const void * ptr (const std::unique_ptr< T > &p)
 
template<typename T >
const void * ptr (const std::shared_ptr< T > &p)
 
template<typename It >
arg_join< It, char > join (It begin, It end, string_view sep)
 
template<typename It >
arg_join< It, wchar_t > join (It begin, It end, wstring_view sep)
 
template<typename Range >
arg_join< internal::iterator_t< const Range >, char > join (const Range &range, string_view sep)
 
template<typename Range >
arg_join< internal::iterator_t< const Range >, wchar_t > join (const Range &range, wstring_view sep)
 
template<typename T >
std::string to_string (const T &value)
 
template<typename T >
std::wstring to_wstring (const T &value)
 
template<typename Char , std::size_t SIZE>
std::basic_string< Char > to_string (const basic_memory_buffer< Char, SIZE > &buf)
 
template<typename S , typename Char = char_t<S>, FMT_ENABLE_IF(internal::is_string< S >::value) >
buffer_context< Char >::iterator vformat_to (internal::buffer< Char > &buf, const S &format_str, basic_format_args< buffer_context< Char >> args)
 
template<typename S , typename... Args, std::size_t SIZE = inline_buffer_size, typename Char = enable_if_t<internal::is_string<S>::value, char_t<S>>>
buffer_context< Char >::iterator format_to (basic_memory_buffer< Char, SIZE > &buf, const S &format_str, Args &&... args)
 
template<typename S , typename OutputIt , typename... Args, FMT_ENABLE_IF( internal::is_output_iterator< OutputIt >::value && !internal::is_contiguous_back_insert_iterator< OutputIt >::value) >
OutputIt vformat_to (OutputIt out, const S &format_str, format_args_t< OutputIt, char_t< S >> args)
 
template<typename OutputIt , typename S , typename... Args, FMT_ENABLE_IF( internal::is_output_iterator< OutputIt >::value && !internal::is_contiguous_back_insert_iterator< OutputIt >::value && internal::is_string< S >::value) >
OutputIt format_to (OutputIt out, const S &format_str, Args &&... args)
 
template<typename OutputIt , typename Char , typename... Args>
format_arg_store< format_to_n_context< OutputIt, Char >, Args... > make_format_to_n_args (const Args &... args)
 
template<typename OutputIt , typename Char , typename... Args, FMT_ENABLE_IF(internal::is_output_iterator< OutputIt >::value) >
format_to_n_result< OutputIt > vformat_to_n (OutputIt out, std::size_t n, basic_string_view< Char > format_str, format_to_n_args< OutputIt, Char > args)
 
template<typename OutputIt , typename S , typename... Args, FMT_ENABLE_IF(internal::is_string< S >::value && internal::is_output_iterator< OutputIt >::value) >
format_to_n_result< OutputIt > format_to_n (OutputIt out, std::size_t n, const S &format_str, const Args &... args)
 
template<typename... Args>
std::size_t formatted_size (string_view format_str, const Args &... args)
 
template<typename Char , FMT_ENABLE_IF(std::is_same< Char, wchar_t >::value) >
void vprint (std::FILE *f, basic_string_view< Char > format_str, wformat_args args)
 
template<typename Char , FMT_ENABLE_IF(std::is_same< Char, wchar_t >::value) >
void vprint (basic_string_view< Char > format_str, wformat_args args)
 

Variables

FMT_EXTERN template struct basic_data< void >
 

Macro Definition Documentation

◆ FMT_ALWAYS_INLINE

#define FMT_ALWAYS_INLINE

Definition at line 802 of file format.h.

◆ FMT_CLANG_VERSION

#define FMT_CLANG_VERSION   0

Definition at line 49 of file format.h.

◆ FMT_CUDA_VERSION

#define FMT_CUDA_VERSION   0

Definition at line 63 of file format.h.

◆ FMT_DEPRECATED_PERCENT

#define FMT_DEPRECATED_PERCENT   0

Definition at line 200 of file format.h.

Referenced by basic_writer< Range >::write().

◆ FMT_FALLTHROUGH

#define FMT_FALLTHROUGH

Definition at line 76 of file format.h.

Referenced by internal::parse_float_type_spec().

◆ FMT_FORMAT_AS

#define FMT_FORMAT_AS (   Type,
  Base 
)
Value:
template <typename Char> \
template <typename FormatContext> \
auto format(const Type& val, FormatContext& ctx) -> decltype(ctx.out()) { \
return formatter<Base, Char>::format(val, ctx); \
} \
}
std::basic_string< Char > format(const text_style &ts, const S &format_str, const Args &... args)
Definition: color.h:562

Definition at line 2969 of file format.h.

◆ FMT_FUNC

#define FMT_FUNC

◆ FMT_HAS_BUILTIN

#define FMT_HAS_BUILTIN (   x)    0

Definition at line 69 of file format.h.

◆ FMT_ICC_VERSION

#define FMT_ICC_VERSION   0

Definition at line 57 of file format.h.

◆ FMT_NUMERIC_ALIGN

#define FMT_NUMERIC_ALIGN   1

Definition at line 195 of file format.h.

◆ FMT_STRING

#define FMT_STRING (   s)    FMT_STRING_IMPL(s, )

Constructs a compile-time format string.

Example**::

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

Definition at line 3528 of file format.h.

◆ FMT_STRING_IMPL

#define FMT_STRING_IMPL (   s,
  ... 
)
Value:
[] { \
struct str : fmt::compile_string { \
using char_type = typename std::remove_cv<std::remove_pointer< \
__VA_ARGS__ FMT_CONSTEXPR \
operator fmt::basic_string_view<char_type>() const { \
return {s, sizeof(s) / sizeof(char_type) - 1}; \
} \
} result; \
/* Suppress Qt Creator warning about unused operator. */ \
(void)static_cast<fmt::basic_string_view<typename str::char_type>>( \
result); \
return result; \
}()
type
Definition: format.h:1010

Definition at line 3502 of file format.h.

◆ FMT_THROW

◆ FMT_USE_GRISU

#define FMT_USE_GRISU   1

Definition at line 517 of file format.h.

Referenced by internal::use_grisu().

◆ FMT_USE_UDL_TEMPLATE

#define FMT_USE_UDL_TEMPLATE   0

Definition at line 127 of file format.h.

◆ FMT_USE_USER_DEFINED_LITERALS

#define FMT_USE_USER_DEFINED_LITERALS   0

Definition at line 113 of file format.h.

◆ FMT_USE_WINDOWS_H

#define FMT_USE_WINDOWS_H   0

Definition at line 935 of file format.h.

Typedef Documentation

◆ align_t

Definition at line 1007 of file format.h.

◆ FMT_DEPRECATED_ALIAS

Definition at line 2653 of file format.h.

◆ format_args_t

Definition at line 3292 of file format.h.

◆ format_context_t

using format_context_t = basic_format_context<OutputIt, Char>

Definition at line 3289 of file format.h.

◆ format_specs

Definition at line 1034 of file format.h.

◆ format_to_n_args

Definition at line 3340 of file format.h.

◆ format_to_n_context

Definition at line 3337 of file format.h.

◆ memory_buffer

Definition at line 687 of file format.h.

◆ sign_t

using sign_t = sign::type

Definition at line 1012 of file format.h.

◆ wmemory_buffer

Definition at line 688 of file format.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
inline_buffer_size 

Definition at line 566 of file format.h.

Function Documentation

◆ advance_to()

◆ FMT_FORMAT_AS() [1/9]

FMT_FORMAT_AS ( signed  char,
int   
)

◆ FMT_FORMAT_AS() [2/9]

FMT_FORMAT_AS ( unsigned  char,
unsigned   
)

◆ FMT_FORMAT_AS() [3/9]

FMT_FORMAT_AS ( short  ,
int   
)

◆ FMT_FORMAT_AS() [4/9]

FMT_FORMAT_AS ( long  ,
long  long 
)

◆ FMT_FORMAT_AS() [5/9]

FMT_FORMAT_AS ( unsigned  long,
unsigned long  long 
)

◆ FMT_FORMAT_AS() [6/9]

FMT_FORMAT_AS ( Char *  ,
const Char *   
)

◆ FMT_FORMAT_AS() [7/9]

FMT_FORMAT_AS ( std::basic_string< Char >  ,
basic_string_view< Char >   
)

◆ FMT_FORMAT_AS() [8/9]

FMT_FORMAT_AS ( std::nullptr_t  ,
const void *   
)

◆ FMT_FORMAT_AS() [9/9]

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

◆ format_system_error()

FMT_API void format_system_error ( internal::buffer< char > &  out,
int  error_code,
string_view  message 
)

Formats an error returned by an operating system or a language runtime, for example a file opening error, and writes it to out in the following form:

.. parsed-literal:: <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. If error_code is not a valid error code such as -1, the system message may look like "Unknown error -1" and is platform-dependent.

Definition at line 1338 of file format-inl.h.

References FMT_CATCH, FMT_TRY, internal::format_error_code(), inline_buffer_size, buffer< T >::resize(), internal::safe_strerror(), buffer< T >::size(), and basic_writer< Range >::write().

Referenced by system_error::error_code(), system_error::init(), and report_system_error().

◆ format_to() [1/2]

buffer_context<Char>::iterator format_to ( basic_memory_buffer< Char, SIZE > &  buf,
const S &  format_str,
Args &&...  args 
)

◆ format_to() [2/2]

OutputIt format_to ( OutputIt  out,
const S &  format_str,
Args &&...  args 
)

Formats arguments, writes the result to the output iterator out and returns the iterator past the end of the output range.

Example**::

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

Definition at line 3321 of file format.h.

References internal::check_format_string(), internal::to_string_view(), and internal::vformat_to().

◆ format_to_n()

format_to_n_result<OutputIt> format_to_n ( OutputIt  out,
std::size_t  n,
const S &  format_str,
const Args &...  args 
)

Formats arguments, writes up to n characters of the result to the output iterator out and returns the total output size and the iterator past the end of the output range.

Definition at line 3369 of file format.h.

References internal::check_format_string(), internal::to_string_view(), and vformat_to_n().

◆ formatted_size()

std::size_t formatted_size ( string_view  format_str,
const Args &...  args 
)

Returns the number of characters in the output of format(format_str, args...).

Definition at line 3392 of file format.h.

References format_to().

◆ join() [1/4]

arg_join<It, char> join ( It  begin,
It  end,
string_view  sep 
)

Returns an object that formats the iterator range [begin, end) with elements separated by sep.

Definition at line 3201 of file format.h.

Referenced by join().

◆ join() [2/4]

arg_join<It, wchar_t> join ( It  begin,
It  end,
wstring_view  sep 
)

Definition at line 3206 of file format.h.

◆ join() [3/4]

arg_join<internal::iterator_t<const Range>, char> join ( const Range &  range,
string_view  sep 
)

Returns an object that formats range with elements separated by sep.

Example**::

std::vector<int> v = {1, 2, 3}; fmt::print("{}", fmt::join(v, ", ")); Output: "1, 2, 3"

Definition at line 3222 of file format.h.

References join().

◆ join() [4/4]

arg_join<internal::iterator_t<const Range>, wchar_t> join ( const Range &  range,
wstring_view  sep 
)

Definition at line 3228 of file format.h.

References join().

◆ make_format_to_n_args()

format_arg_store<format_to_n_context<OutputIt, Char>, Args...> make_format_to_n_args ( const Args &...  args)

Definition at line 3344 of file format.h.

References FMT_ENABLE_IF.

◆ ptr() [1/3]

◆ ptr() [2/3]

const void* ptr ( const std::unique_ptr< T > &  p)

Definition at line 3160 of file format.h.

◆ ptr() [3/3]

const void* ptr ( const std::shared_ptr< T > &  p)

Definition at line 3163 of file format.h.

◆ report_system_error()

FMT_API void report_system_error ( int  error_code,
string_view  message 
)

◆ to_string() [1/2]

std::string to_string ( const T &  value)

Converts value to std::string using the default format for type T. It doesn't support user-defined types with custom formatters.

Example**::

#include <fmt/format.h>

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

Definition at line 3245 of file format.h.

References format().

Referenced by compiled_format< S, Args >::compiled_format(), format(), formatter< internal::bigint >::format(), system_error::init(), vformat(), internal::vformat(), and vsprintf().

◆ to_string() [2/2]

std::basic_string<Char> to_string ( const basic_memory_buffer< Char, SIZE > &  buf)

Definition at line 3257 of file format.h.

References buffer< T >::data(), and buffer< T >::size().

◆ to_wstring()

std::wstring to_wstring ( const T &  value)

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

Definition at line 3252 of file format.h.

References format().

◆ vformat_to() [1/3]

Context::iterator vformat_to ( typename ArgFormatter::range  out,
basic_string_view< Char >  format_str,
basic_format_args< Context >  args,
internal::locale_ref  loc = internal::locale_ref() 
)

Formats arguments and writes the output to the range.

Definition at line 3147 of file format.h.

References format_handler< ArgFormatter, Char, Context >::context.

◆ vformat_to() [2/3]

buffer_context<Char>::iterator vformat_to ( internal::buffer< Char > &  buf,
const S &  format_str,
basic_format_args< buffer_context< Char >>  args 
)

Definition at line 3272 of file format.h.

References inline_buffer_size, internal::to_string_view(), and internal::vformat_to().

◆ vformat_to() [3/3]

OutputIt vformat_to ( OutputIt  out,
const S &  format_str,
format_args_t< OutputIt, char_t< S >>  args 
)

Definition at line 3298 of file format.h.

References FMT_ENABLE_IF, and internal::to_string_view().

◆ vformat_to_n()

format_to_n_result<OutputIt> vformat_to_n ( OutputIt  out,
std::size_t  n,
basic_string_view< Char >  format_str,
format_to_n_args< OutputIt, Char >  args 
)

Definition at line 3351 of file format.h.

References FMT_ENABLE_IF, and internal::vformat_to().

Referenced by format_to_n().

◆ vprint() [1/2]

void vprint ( std::FILE *  f,
basic_string_view< Char >  format_str,
wformat_args  args 
)

Definition at line 3397 of file format.h.

References buffer< T >::data(), FMT_THROW, buffer< T >::push_back(), and internal::vformat_to().

Referenced by vprint().

◆ vprint() [2/2]

void vprint ( basic_string_view< Char >  format_str,
wformat_args  args 
)

Definition at line 3407 of file format.h.

References FMT_CONSTEXPR, FMT_CONSTEXPR_DECL, FMT_END_NAMESPACE, format(), and vprint().