diff --git a/source/support.tex b/source/support.tex index f446e54830..cac813cf90 100644 --- a/source/support.tex +++ b/source/support.tex @@ -628,7 +628,7 @@ #define @\defnlibxname{cpp_lib_filesystem}@ 201703L // also in \libheader{filesystem} #define @\defnlibxname{cpp_lib_flat_map}@ 202207L // also in \libheader{flat_map} #define @\defnlibxname{cpp_lib_flat_set}@ 202207L // also in \libheader{flat_set} -#define @\defnlibxname{cpp_lib_format}@ 202304L // also in \libheader{format} +#define @\defnlibxname{cpp_lib_format}@ 202305L // also in \libheader{format} #define @\defnlibxname{cpp_lib_format_ranges}@ 202207L // also in \libheader{format} #define @\defnlibxname{cpp_lib_formatters}@ 202302L // also in \libheader{stacktrace}, \libheader{thread} #define @\defnlibxname{cpp_lib_forward_like}@ 202207L // freestanding, also in \libheader{utility} diff --git a/source/utilities.tex b/source/utilities.tex index fdc9737574..55113474ef 100644 --- a/source/utilities.tex +++ b/source/utilities.tex @@ -15442,9 +15442,9 @@ If \tcode{\{ \opt{\fmtgrammarterm{arg-id}} \}} is used in a \fmtgrammarterm{width} or \fmtgrammarterm{precision} option, the value of the corresponding formatting argument is used as the value of the option. -If the corresponding formatting argument is -not of standard signed or unsigned integer type, or -its value is negative, +The option is valid only if the corresponding formatting argument is +of standard signed or unsigned integer type. +If its value is negative, an exception of type \tcode{format_error} is thrown. \pnum @@ -16555,8 +16555,7 @@ size_t num_args_; // \expos public: - constexpr explicit basic_format_parse_context(basic_string_view fmt, - size_t num_args = 0) noexcept; + constexpr explicit basic_format_parse_context(basic_string_view fmt) noexcept; basic_format_parse_context(const basic_format_parse_context&) = delete; basic_format_parse_context& operator=(const basic_format_parse_context&) = delete; @@ -16566,6 +16565,11 @@ constexpr size_t next_arg_id(); constexpr void check_arg_id(size_t id); + + template + constexpr void check_dynamic_spec(size_t id) noexcept; + constexpr void check_dynamic_spec_integral(size_t id) noexcept; + constexpr void check_dynamic_spec_string(size_t id) noexcept; }; } \end{codeblock} @@ -16578,8 +16582,7 @@ \indexlibraryctor{basic_format_parse_context}% \begin{itemdecl} -constexpr explicit basic_format_parse_context(basic_string_view fmt, - size_t num_args = 0) noexcept; +constexpr explicit basic_format_parse_context(basic_string_view fmt) noexcept; \end{itemdecl} \begin{itemdescr} @@ -16590,7 +16593,13 @@ \tcode{end_} with \tcode{fmt.end()}, \tcode{indexing_} with \tcode{unknown}, \tcode{next_arg_id_} with \tcode{0}, and -\tcode{num_args_} with \tcode{num_args}. +\tcode{num_args_} with \tcode{0}. +\begin{note} +Any call to +\tcode{next_arg_id}, \tcode{check_arg_id}, or \tcode{check_dynamic_spec} +on an instance of \tcode{basic_format_parse_context} +initialized using this constructor is not a core constant expression. +\end{note} \end{itemdescr} \indexlibrarymember{begin}{basic_format_parse_context}% @@ -16683,6 +16692,68 @@ core constant expressions\iref{expr.const}. \end{itemdescr} +\indexlibrarymember{check_dynamic_spec}{basic_format_parse_context}% +\begin{itemdecl} +template + constexpr void check_dynamic_spec(size_t id) noexcept; +\end{itemdecl} + +\begin{itemdescr} +\pnum +\mandates +The types in \tcode{Ts...} are unique. +Each type in \tcode{Ts...} is one of +\keyword{bool}, +\tcode{char_type}, +\keyword{int}, +\tcode{\keyword{unsigned} \keyword{int}}, +\tcode{\keyword{long} \keyword{long} \keyword{int}}, +\tcode{\keyword{unsigned} \keyword{long} \keyword{long} \keyword{int}}, +\keyword{float}, +\keyword{double}, +\tcode{\keyword{long} \keyword{double}}, +\tcode{\keyword{const} char_type*}, +\tcode{basic_string_view}, or +\tcode{\keyword{const} \keyword{void}*}. + +\pnum +\remarks +Call expressions where +\tcode{id >= num_args_} or +the type of the corresponding format argument +(after conversion to \tcode{basic_format_arg}) +is not one of the types in \tcode{Ts...} +are not core constant expressions\iref{expr.const}. +\end{itemdescr} + +\indexlibrarymember{check_dynamic_spec_integral}{basic_format_parse_context}% +\begin{itemdecl} +constexpr void check_dynamic_spec_integral(size_t id) noexcept; +\end{itemdecl} + +\begin{itemdescr} +\pnum +\effects +Equivalent to: +\begin{codeblock} +check_dynamic_spec(id); +\end{codeblock} +\end{itemdescr} + +\indexlibrarymember{check_dynamic_spec_string}{basic_format_parse_context}% +\begin{itemdecl} +constexpr void check_dynamic_spec_string(size_t id) noexcept; +\end{itemdecl} + +\begin{itemdescr} +\pnum +\effects +Equivalent to: +\begin{codeblock} +check_dynamic_spec>(id); +\end{codeblock} +\end{itemdescr} + \rSec3[format.context]{Class template \tcode{basic_format_context}} \indexlibraryglobal{basic_format_context}%