Agora
1.2.0
Agora project
|
#include <args.h>
Classes | |
struct | need_copy |
Public Member Functions | |
constexpr | dynamic_format_arg_store ()=default |
template<typename T > | |
void | push_back (const T &arg) |
template<typename T > | |
void | push_back (std::reference_wrapper< T > arg) |
template<typename T > | |
void | push_back (const detail::named_arg< char_type, T > &arg) |
void | clear () |
void | reserve (size_t new_cap, size_t new_cap_named) |
Private Types | |
using | char_type = typename Context::char_type |
template<typename T > | |
using | stored_type = conditional_t< detail::is_string< T >::value &&!has_formatter< T, Context >::value &&!detail::is_reference_wrapper< T >::value, std::basic_string< char_type >, T > |
Private Member Functions | |
unsigned long long | get_types () const |
const basic_format_arg< Context > * | data () const |
template<typename T > | |
void | emplace_arg (const T &arg) |
template<typename T > | |
void | emplace_arg (const detail::named_arg< char_type, T > &arg) |
Private Attributes | |
std::vector< basic_format_arg< Context > > | data_ |
std::vector< detail::named_arg_info< char_type > > | named_info_ |
detail::dynamic_arg_list | dynamic_args_ |
Friends | |
class | basic_format_args< Context > |
\rst A dynamic version of fmt::format_arg_store
. It's equipped with a storage to potentially temporary objects which lifetimes could be shorter than the format arguments object.
It can be implicitly converted into ~fmt::basic_format_args
for passing into type-erased formatting functions such as ~fmtvformat
. \endrst
|
private |
|
private |
|
constexprdefault |
|
inline |
Erase all elements from the store
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inline |
Adds named argument into the dynamic store for later passing to a formatting function. std::reference_wrapper
is supported to avoid copying of the argument. The name is always copied into the store.
|
inline |
\rst Adds an argument into the dynamic store for later passing to a formatting function.
Note that custom types and string types (but not string views) are copied into the store dynamically allocating memory if necessary.
Example**::
fmt::dynamic_format_arg_store<fmt::format_context> store; store.push_back(42); store.push_back("abc"); store.push_back(1.5f); std::string result = fmt::vformat("{} and {} and {}", store); \endrst
|
inline |
\rst Adds a reference to the argument into the dynamic store for later passing to a formatting function. Example**:: fmt::dynamic_format_arg_store<fmt::format_context> store; char band[] = "Rolling Stones"; store.push_back(std::cref(band)); band[9] = 'c'; // Changing str affects the output. std::string result = fmt::vformat("{}", store);
result == "Rolling Scones" \endrst
|
inline |
\rst Reserves space to store at least new_cap arguments including new_cap_named* named arguments. \endrst
|
friend |
|
private |
|
private |
|
private |