| Defined in header <format> | ||
|---|---|---|
| template< class CharT > class basic_format_parse_context; | (since C++20) | 
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.
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> | 
| Type | Definition | 
|---|---|
| char_type | CharT | 
| iterator | std::basic_string_view<CharT>::const_iterator | 
| const_iterator | std::basic_string_view<CharT>::const_iterator | 
| (constructor) | constructs a std::basic_format_parse_contextinstance from format string and argument count(public member function) | 
| operator= [deleted] | std::basic_format_parse_contextis not copyable(public member function) | 
| begin | returns an iterator to the beginning of the format string range (public member function) | 
| end | returns an iterator to the end of the format string range (public member function) | 
| advance_to | advances the begin iterator to the given position (public member function) | 
| next_arg_id | enters automatic indexing mode, and returns the next argument index (public member function) | 
| check_arg_id | enters manual indexing mode, checks if the given argument index is in range (public member function) | 
| constexpr explicit basic_format_parse_context( std::basic_string_view<CharT> fmt,
                                               std::size_t num_args = 0 ) noexcept; | (1) | |
| basic_format_parse_context( const basic_format_parse_context& ) = delete; | (2) | 
std::basic_format_parse_context instance. Initializes the format string range to [fmt.begin(), fmt.end()), and the argument count to num_args.std::basic_format_parse_context is not copyable. | constexpr const_iterator begin() const noexcept; | 
Returns an iterator to the beginning of the format string range.
| constexpr const_iterator end() const noexcept; | 
Returns an iterator to the end of the format string range.
| constexpr void advance_to( const_iterator it ); | 
Sets the beginning of the format string range to it. After a call to advance_to(), subsequent calls to begin() will return a copy of it.
The behavior is undefined if end() is not reachable from it.
| 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 provided in the constructor, the call is not a core constant expression.
| 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 constructor, the call is not a core constant expression.
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
| DR | Applied to | Behavior as published | Correct behavior | 
|---|---|---|---|
| LWG 3825 | C++20 | check_arg_idhas a compile-time argumentidcheck, butnext_arg_iddid not have | added | 
    © cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
    https://en.cppreference.com/w/cpp/utility/format/basic_format_parse_context