table of contents
std::basic_format_parse_context(3) | C++ Standard Libary | std::basic_format_parse_context(3) |
NAME¶
std::basic_format_parse_context - std::basic_format_parse_context
Synopsis¶
Defined in header <format>
template<class CharT> (1) (since C++20)
class basic_format_parse_context;
using format_parse_context = basic_format_parse_context<char>;
(2) (since C++20)
using wformat_parse_context = basic_format_parse_context<wchar_t>;
(3) (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 basic_format_parse_context instance is passed to Formatter when parsing the
format
specification.
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 from format
constructor string and argument count
(public member function)
operator= std::basic_format_parse_context is not copyable
[deleted] (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)
enters manual indexing mode, checks if the given argument index is in
check_arg_id range
(public member function)
std::basic_format_parse_context::basic_format_parse_context
constexpr explicit
basic_format_parse_context(std::basic_string_view<CharT>
fmt, (1)
std::size_t num_args = 0) noexcept;
basic_format_parse_context(const basic_format_parse_context&) = delete;
(2)
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.
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
advance_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.
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 argument count provided in the
constructor, the
call is not a constant expression.
Example¶
This section is incomplete
Reason: no example
See also¶
2022.07.31 | http://cppreference.com |