SoPlex Documentation
Loading...
Searching...
No Matches
compile.h File Reference
#include <vector>
#include "format.h"

Go to the source code of this file.

Classes

class  compiled_string
 
struct  is_compiled_string< S >
 
struct  format_part< Char >
 
struct  format_part< Char >::replacement
 
union  format_part< Char >::value
 
struct  part_counter< Char >
 
class  format_string_compiler< Char, PartHandler >
 
struct  basic_compiled_format
 
struct  compiled_format_base< S, typename >
 
struct  format_part_array< Char, N >
 
struct  compiled_format_base< S, enable_if_t< is_compile_string< S >::value > >
 
class  compiled_format< S, Args >
 

Namespaces

namespace  detail
 
namespace  detail::cf
 

Macros

#define FMT_COMPILE(s)   FMT_STRING_IMPL(s, fmt::detail::compiled_string)
 

Functions

template<typename T , typename... Tail>
const T & first (const T &value, const Tail &...)
 
template<typename Char >
FMT_CONSTEXPR unsigned count_parts (basic_string_view< Char > format_str)
 
template<bool IS_CONSTEXPR, typename Char , typename PartHandler >
FMT_CONSTEXPR void compile_format_string (basic_string_view< Char > format_str, PartHandler handler)
 
template<typename OutputIt , typename Context , typename Id >
void format_arg (basic_format_parse_context< typename Context::char_type > &parse_ctx, Context &ctx, Id arg_id)
 
template<typename Context , typename OutputIt , typename CompiledFormat >
auto vformat_to (OutputIt out, CompiledFormat &cf, basic_format_args< Context > args) -> typename Context::iterator
 
template<typename Char , unsigned N>
FMT_CONSTEXPR format_part_array< Char, N > compile_to_parts (basic_string_view< Char > format_str)
 
template<typename T >
constexpr const T & constexpr_max (const T &a, const T &b)
 
template<typename... Args, typename S , FMT_ENABLE_IF(is_compile_string< S >::value) >
constexpr auto compile (S format_str) -> detail::compiled_format< S, Args... >
 
template<typename... Args, typename Char , size_t N>
auto compile (const Char(&format_str)[N]) -> detail::compiled_format< const Char *, Args... >
 
template<typename... Args>
FMT_DEPRECATED auto compile (const Args &... args) -> decltype(detail::compile(args...))
 
template<typename CompiledFormat , typename... Args, typename Char = typename CompiledFormat::char_type, FMT_ENABLE_IF(std::is_base_of< detail::basic_compiled_format, CompiledFormat >::value) >
std::basic_string< Char > format (const CompiledFormat &cf, const Args &... args)
 
template<typename S , typename... Args, FMT_ENABLE_IF(detail::is_compiled_string< S >::value) >
FMT_INLINE std::basic_string< typename S::char_type > format (const S &, Args &&... args)
 
template<typename OutputIt , typename CompiledFormat , typename... Args, FMT_ENABLE_IF(std::is_base_of< detail::basic_compiled_format, CompiledFormat >::value) >
OutputIt format_to (OutputIt out, const CompiledFormat &cf, const Args &... args)
 
template<typename OutputIt , typename S , typename... Args, FMT_ENABLE_IF(detail::is_compiled_string< S >::value) >
OutputIt format_to (OutputIt out, const S &, const Args &... args)
 
template<typename OutputIt , typename CompiledFormat , typename... Args>
auto format_to_n (OutputIt out, size_t n, const CompiledFormat &cf, const Args &... args) -> typename std::enable_if< detail::is_output_iterator< OutputIt, typename CompiledFormat::char_type >::value &&std::is_base_of< detail::basic_compiled_format, CompiledFormat >::value, format_to_n_result< OutputIt > >::type
 
template<typename OutputIt , typename S , typename... Args, FMT_ENABLE_IF(detail::is_compiled_string< S >::value) >
format_to_n_result< OutputIt > format_to_n (OutputIt out, size_t n, const S &, const Args &... args)
 
template<typename CompiledFormat , typename... Args>
size_t formatted_size (const CompiledFormat &cf, const Args &... args)
 

Macro Definition Documentation

◆ FMT_COMPILE

#define FMT_COMPILE ( s)    FMT_STRING_IMPL(s, fmt::detail::compiled_string)

\rst Converts a string literal s into a format string that will be parsed at compile time and converted into efficient formatting code. Requires C++17 constexpr if compiler support.

Example**::

Converts 42 into std::string using the most efficient method and no runtime format string processing. std::string s = fmt::format(FMT_COMPILE("{}"), 42); \endrst

Definition at line 37 of file compile.h.

Function Documentation

◆ compile()

template<typename... Args>
FMT_DEPRECATED auto compile ( const Args &... args) -> decltype(detail::compile(args...))

Definition at line 598 of file compile.h.

References detail::compile().

◆ format() [1/2]

template<typename CompiledFormat , typename... Args, typename Char = typename CompiledFormat::char_type, FMT_ENABLE_IF(std::is_base_of< detail::basic_compiled_format, CompiledFormat >::value) >
std::basic_string< Char > format ( const CompiledFormat & cf,
const Args &... args )

Definition at line 629 of file compile.h.

References to_string().

Referenced by format().

◆ format() [2/2]

template<typename S , typename... Args, FMT_ENABLE_IF(detail::is_compiled_string< S >::value) >
FMT_INLINE std::basic_string< typename S::char_type > format ( const S & ,
Args &&... args )

◆ format_to() [1/2]

template<typename OutputIt , typename CompiledFormat , typename... Args, FMT_ENABLE_IF(std::is_base_of< detail::basic_compiled_format, CompiledFormat >::value) >
OutputIt format_to ( OutputIt out,
const CompiledFormat & cf,
const Args &... args )

Definition at line 655 of file compile.h.

Referenced by format_to(), format_to_n(), format_to_n(), and formatted_size().

◆ format_to() [2/2]

template<typename OutputIt , typename S , typename... Args, FMT_ENABLE_IF(detail::is_compiled_string< S >::value) >
OutputIt format_to ( OutputIt out,
const S & ,
const Args &... args )

Definition at line 665 of file compile.h.

References detail::compile(), and format_to().

◆ format_to_n() [1/2]

template<typename OutputIt , typename CompiledFormat , typename... Args>
auto format_to_n ( OutputIt out,
size_t n,
const CompiledFormat & cf,
const Args &... args ) -> typename std::enable_if< detail::is_output_iterator<OutputIt, typename CompiledFormat::char_type>::value && std::is_base_of<detail::basic_compiled_format, CompiledFormat>::value, format_to_n_result<OutputIt>>::type

Definition at line 671 of file compile.h.

References format_to().

◆ format_to_n() [2/2]

template<typename OutputIt , typename S , typename... Args, FMT_ENABLE_IF(detail::is_compiled_string< S >::value) >
format_to_n_result< OutputIt > format_to_n ( OutputIt out,
size_t n,
const S & ,
const Args &... args )

Definition at line 686 of file compile.h.

References detail::compile(), and format_to().

◆ formatted_size()

template<typename CompiledFormat , typename... Args>
size_t formatted_size ( const CompiledFormat & cf,
const Args &... args )

Definition at line 695 of file compile.h.

References format_to().