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

NAME
     std::basic_format_context - std::basic_format_context

Synopsis
	Defined in header <format>
	template<  class  OutputIt, class CharT >			     (1)
     (since C++20)
	class basic_format_context;
	using format_context = basic_format_context</* unspecified  */,      (2)
     (since C++20)
	char>;
	using  wformat_context	= basic_format_context</* unspecified */,    (3)
     (since C++20)
	wchar_t>;

	Provides access to formatting state consisting of the  formatting  argu-
     ments and the
	output iterator.

	2)  The unspecified template argument is an output iterator that appends
     to
	std::string, such as std::back_insert_iterator<std::string>. Implementa-
     tions
	typically use an iterator to type-erased buffer type that  supports  ap-
     pending to any
	contiguous and resizable container.
	3)  The unspecified template argument is an output iterator that appends
     to
	std::wstring.

	The behavior is undefined if OutputIt does not model  std::output_itera-
     tor<const
	CharT&>.

	A program that declares an explicit or partial specialization of
	std::basic_format_context is ill-formed, no diagnostic required.

Member types
	Type	  Definition
	iterator  OutputIt
	char_type CharT

Member alias templates
	Type		  Definition
	formatter_type<T> std::formatter<T, CharT>

Member functions
	arg	   returns the argument at the given index
		   (public member function)
	locale	   returns the locale used for locale-specific formatting
		   (public member function)
	out	   returns the iterator to output buffer
		   (public member function)
	advance_to advances the output iterator to the given position
		   (public member function)

     std::basic_format_context::arg

	std::basic_format_arg<basic_format_context> arg( std::size_t id ) const;

	Returns  a  std::basic_format_arg  holding  the  id-th argument in args,
     where args is
	the parameter pack or std::basic_format_args object passed to  the  for-
     matting
	function.

	If id is not less than the number of formatting arguments, returns a
	default-constructed  std::basic_format_arg (holding a std::monostate ob-
     ject).

     std::basic_format_context::locale

	std::locale locale();

	Returns the locale passed to the formatting function, or a  default-con-
     structed
	std::locale if the formatting function does not take a locale.

     std::basic_format_context::out

	iterator out();

	Returns  the  iterator	to  the  output  buffer. The result is move-con-
     structed from the
	stored iterator.

     std::basic_format_context::advance_to

	void advance_to( iterator it );

	Move assigns it to the stored output  iterator.  After	a  call  to  ad-
     vance_to, the next
	call  to out() will return an iterator with the value that it had before
     the
	assignment.

Example
	 This section is incomplete
	 Reason: no example

	Defect reports

	The following behavior-changing defect	reports  were  applied	retroac-
     tively to
	previously published C++ standards.

	   DR	  Applied to		 Behavior as published		    Cor-
     rect behavior
	LWG 3567 C++20	    basic_format_context does not work move-only    made
     to move
			    iterator types				   iter-
     ators
	LWG  3975 C++20      user specialization of basic_format_context    dis-
     allowed
			    was allowed

Category:
	  * Todo no example

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

home | help