Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
std::basic_..._arg::handle(3) C++ Standard Libarystd::basic_..._arg::handle(3)

NAME
       std::basic_format_arg::handle - std::basic_format_arg::handle

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

	  A type-erased	wrapper	that allows formatting an object of a user-de-
       fined 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).

Member functions
	  format  formats the referenced object	with the given contexts
	  (C++20) (public member function)

       std::basic_format_arg<Context>::handle::format

	  void	format(	  std::basic_format_parse_context<Context::char_type>&
       (since
	  parse_ctx,
       C++20)
		       Context&	format_ctx ) const;

	  Let

	    * T	be the type of the formatting argument,
	    * TD be std::remove_const_t<T>,
	    * TQ be const TD if	const TD satisfies __formattable_with<Context>
       or TD
	      otherwise, and
	    * ref be a reference to the	formatting argument.

	  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));

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	 func-
       tions.

See also
	  basic_format_arg   class  template that provides access to a format-
       ting argument for
	  (C++20)	    user-defined formatters
			    (class template)
	  make_format_args  creates a type-erased object referencing all  for-
       matting arguments,
	  make_wformat_args convertible	to format_args
	  (C++20)	    (function template)
	  (C++20)

http://cppreference.com		  2024.06.10	 std::basic_..._arg::handle(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=std::basic_format_arg::handle&sektion=3&manpath=FreeBSD+Ports+15.1.quarterly>

home | help