A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://en.cppreference.com/w/cpp/language/../utility/format/basic_format_arg/handle.html below:

std::basic_format_arg<Context>::handle - cppreference.com

template< class Context >
class basic_format_arg<Context>::handle;

(since C++20)

A type-erased wrapper that allows formatting an object of a user-defined type.

handle objects are typically created by std::make_format_args and accessed through std::visit_format_arg or the visit member functions of std::basic_format_arg(since C++26).

[edit] Data members

A typical implementation of handle is TriviallyCopyable and only stores two non-static data members:

[edit] Member functions formats the referenced object with the given contexts
(public member function) std::basic_format_arg<Context>::handle::format

Let

Equivalent to: typename Context::template formatter_type<TD> f;
parse_ctx.advance_to(f.parse(parse_ctx));
format_ctx.advance_to(f.format(const_cast<TQ&>(static_cast<const TD&>(ref)), format_ctx));

[edit] Notes

A handle has reference semantics for the formatted argument and does not extend its lifetime. It is the programmer's responsibility to ensure that the argument outlives the handle. Usually, a handle is only used within formatting functions.

[edit] See also class template that provides access to a formatting argument for user-defined formatters
(class template) [edit] creates a type-erased object referencing all formatting arguments, convertible to format_args
(function template) [edit]

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4