home | help
std::basic_...arse_context(3)  C++ Standard Libary std::basic_...arse_context(3)

NAME
     std::basic_format_parse_context - std::basic_format_parse_context

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

	Provides  access  to  the  format string parsing state consisting of the
     format string
	range being parsed and the argument counter for automatic indexing.

	A std::basic_format_parse_context instance is passed to  Formatter  when
     parsing the
	format specification.

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

	Several typedefs for common character types are provided:

	Defined in header <format>
	Type			   Definition
	std::format_parse_context  std::basic_format_parse_context<char>
	std::wformat_parse_context std::basic_format_parse_context<wchar_t>

Member types
	Type	       Definition
	char_type      CharT
	iterator       std::basic_string_view<CharT>::const_iterator
	const_iterator std::basic_string_view<CharT>::const_iterator

Member functions
				    constructs a std::basic_format_parse_context
     instance
	constructor		    from format string and argument count
				    (public member function)
	operator=		    std::basic_format_parse_context is not copy-
     able
	[deleted]		    (public member function)
				    returns  an iterator to the beginning of the
     format
	begin			    string range
				    (public member function)
				    returns an iterator to the end of the format
     string
	end			    range
				    (public member function)
	advance_to		    advances the begin iterator to the given po-
     sition
				    (public member function)
				    enters automatic indexing mode, and  returns
     the next
	next_arg_id		    argument index
				    (public member function)
				    enters  manual  indexing mode, checks if the
     given
	check_arg_id		    argument index is in range
				    (public member function)
				    checks if the type of the corresponding for-
     mat argument
	check_dynamic_spec	    with the given  argument  index  is  in  the
     given type
	(C++26) 		    template arguments
				    (public member function)
	check_dynamic_spec_integral checks if the type of the corresponding for-
     mat argument
	(C++26) 		    with the given argument index is an integral
     type
				    (public member function)
	check_dynamic_spec_string   checks if the type of the corresponding for-
     mat argument
	(C++26) 		     with  the	given argument index is a string
     type
				    (public member function)

     std::basic_format_parse_context::basic_format_parse_context

	constexpr explicit

	basic_format_parse_context(	 std::basic_string_view<CharT>	    fmt,
     (until C++26)

				    std::size_t num_args = 0 )
	noexcept;						       (1)
	constexpr explicit
	basic_format_parse_context(	  std::basic_string_view<CharT>      fmt
     (since C++26)
	) noexcept;
	basic_format_parse_context( const basic_format_parse_context&	   (2)
	) = delete;

	1) Constructs a  std::basic_format_parse_context  instance.  Initializes
     the format
	string range to [fmt.begin(), fmt.end()), and the argument count to
	num_args
	(until C++26)
	0
	(since C++26).

	Any call to next_arg_id, check_arg_id, or check_dynamic_spec on an
	instance   of  std::basic_format_parse_context	initialized  using  this
     (since C++26)
	constructor is not a core constant expression.

	2) The copy constructor is deleted.  std::basic_format_parse_context  is
     not copyable.

     std::basic_format_parse_context::begin

	constexpr const_iterator begin() const noexcept;

	Returns an iterator to the beginning of the format string range.

     std::basic_format_parse_context::end

	constexpr const_iterator end() const noexcept;

	Returns an iterator to the end of the format string range.

     std::basic_format_parse_context::advance_to

	constexpr void advance_to( const_iterator it );

	Sets the beginning of the format string range to it. After a call to ad-
     vance_to(),
	subsequent calls to begin() will return a copy of it.

	The behavior is undefined if end() is not reachable from it.

     std::basic_format_parse_context::next_arg_id

	constexpr std::size_t next_arg_id();

	Enters	automatic  argument indexing mode, and returns the next argument
     index,
	starting from 0.

	If *this has already entered manual argument indexing mode, throws
	std::format_error.

	If the next argument index is larger than or equal to the num_args  pro-
     vided in the
	constructor, the call is not a core constant expression.

     std::basic_format_parse_context::check_arg_id

	constexpr void check_arg_id( std::size_t id );

	Enters manual argument indexing mode.

	If *this has already entered automatic argument indexing mode, throws
	std::format_error.

	If  id is larger than or equal to the num_args provided in the construc-
     tor, the call
	is not a core constant expression.

     std::basic_format_parse_context::check_dynamic_spec

	template< class...  Ts	>					  (since
     C++26)
	constexpr void check_dynamic_spec( std::size_t id ) noexcept;

	If  id is larger than or equal to the num_args provided in the construc-
     tor or the
	type of the corresponding format argument (after conversion to
	std::basic_format_arg) is not one of the types in Ts..., the call is not
     a core
	constant expression. A call to check_dynamic_spec has no effect at  run-
     time.

	  *  This overload participates in overload resolution only if the types
     in Ts... are
	    unique and each type is one of bool, char_type, int,  unsigned  int,
     long long
	    int,  unsigned  long  long	int,  float,  double, long double, const
     char_type*,
	    std::basic_string_view<char_type>, or const void*.

     std::basic_format_parse_context::check_dynamic_spec_integral

	constexpr   void   check_dynamic_spec_integral(   std::size_t	 id    )
     (since C++26)
	noexcept;

	Equivalent  to call check_dynamic_spec<int, unsigned int, long long int,
     unsigned
	long long int>(id). A call to check_dynamic_spec_integral has no  effect
     at runtime.

     std::basic_format_parse_context::check_dynamic_spec_string

	constexpr  void  check_dynamic_spec_string(  std::size_t  id ) noexcept;
     (since C++26)

	Equivalent to call check_dynamic_spec<const char_type*,
	std::basic_string_view<char_type>>(id).    A	call	to     check_dy-
     namic_spec_string has no
	effect at runtime.

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  3825  C++20	check_arg_id   has   a	 compile-time	argument
     added
			    id check, but next_arg_id did not have
	LWG 3975 C++20	    user specialization of			    dis-
     allowed
			    basic_format_parse_context was allowed

Category:
	  * Todo no example

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

home | help