home | help
std::basic_format_arg(3)       C++ Standard Libary	std::basic_format_arg(3)

NAME
     std::basic_format_arg - std::basic_format_arg

Synopsis
	Defined in header <format>
	template< class Context >   (since C++20)
	class basic_format_arg;

	Provides access to a formatting argument.

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

	A basic_format_arg object behaves as if it stores a std::variant of  the
     following
	types:

	  * std::monostate (only if the object was default-constructed)
	  * bool
	  * Context::char_type
	  * int
	  * unsigned int
	  * long long int
	  * unsigned long long int
	  * float
	  * double
	  * long double
	  * const Context::char_type*
	  * std::basic_string_view<Context::char_type>
	  * const void*
	  * basic_format_arg::handle

Member classes
	handle	type-erased wrapper that allows formatting an object of user-de-
     fined type
	(C++20) (public member class)

Member functions
	constructor   constructs a std::basic_format_arg
	(C++20)       (public member function)
	operator bool checks if the current object holds a formatting argument
	(C++20)       (public member function)
	visit	      visit the stored formatting argument
	(C++26)       (public member function)

Non-member functions
	visit_format_arg	      argument visitation interface for user-de-
     fined
	(C++20) (deprecated in C++26) formatters
				      (function template)

     std::basic_format_arg::basic_format_arg

	basic_format_arg() noexcept;  (since C++20)

	Default  constructor. Constructs a basic_format_arg that does not hold a
     formatting
	argument. The stored object has type std::monostate.

	To  create  a  basic_format_arg  that  holds  a   formatting   argument,
     std::make_format_args
	has to be used.

     std::basic_format_arg::operator bool

	explicit operator bool() const noexcept;  (since C++20)

	Checks whether *this holds a formatting argument.

	Returns  true  if *this holds a formatting argument (i.e. the stored ob-
     ject does not
	have type std::monostate), false otherwise.

     std::basic_format_arg::visit

	template< class  Visitor  >					     (1)
     (since C++26)
	decltype(auto) visit( this basic_format_arg arg, Visitor&& vis );
	template<  class  R,  class Visitor >				     (2)
     (since C++26)
	R visit( this basic_format_arg arg, Visitor&& vis );

	Applies the visitor vis to the object contained in arg.

	The visit functions do not modify the basic_format_arg object  on  which
     it is called
	because a copy of the object is used when calling vis.

	1)  Equivalent	to  return  std::visit(std::forward<Visitor>(vis),  v);,
     where v is the
	std::variant stored in arg.
	2) Equivalent to return  std::visit<R>(std::forward<Visitor>(vis),  v);,
     where v is
	the std::variant stored in arg.

Notes
	Feature-test macro  Value    Std     Feature
	__cpp_lib_format   202306L (C++26) Member visit

Example
	 This section is incomplete
	 Reason: no example

See also
	basic_format_args
	format_args
	wformat_args	  class that provides access to all formatting arguments
	(C++20) 	  (class template)
	(C++20)
	(C++20)

Category:
	  * Todo no example

http://cppreference.com 	   2024.06.10		std::basic_format_arg(3)

home | help