@@ -15744,17 +15744,20 @@
15744
15744
\tcode{\libconcept{output_iterator}<const charT\&>}\iref{iterator.concept.output}.
15745
15745
15746
15746
\begin{codeblock}
15747
+ template<class T, class Context,
15748
+ class Formatter = typename Context::template formatter_type<remove_const_t<T>>>
15749
+ concept @\defexposconcept{formattable-with}@ = // \expos
15750
+ @\libconcept{semiregular}@<Formatter> &&
15751
+ requires(Formatter& f, const Formatter& cf, T&& t, Context fc,
15752
+ basic_format_parse_context<typename Context::char_type> pc)
15753
+ {
15754
+ { f.parse(pc) } -> @\libconcept{same_as}@<typename decltype(pc)::iterator>;
15755
+ { cf.format(t, fc) } -> @\libconcept{same_as}@<typename Context::iterator>;
15756
+ };
15757
+
15747
15758
template<class T, class charT>
15748
15759
concept @\deflibconcept{formattable}@ =
15749
- @\libconcept{semiregular}@<formatter<remove_cvref_t<T>, charT>> &&
15750
- requires(formatter<remove_cvref_t<T>, charT> f,
15751
- const formatter<remove_cvref_t<T>, charT> cf,
15752
- T t,
15753
- basic_format_context<@\placeholder{fmt-iter-for}@<charT>, charT> fc,
15754
- basic_format_parse_context<charT> pc) {
15755
- { f.parse(pc) } -> @\libconcept{same_as}@<basic_format_parse_context<charT>::iterator>;
15756
- { cf.format(t, fc) } -> @\libconcept{same_as}@<@\placeholder{fmt-iter-for}@<charT>>;
15757
- };
15760
+ @\exposconcept{formattable-with}@<remove_reference_t<T>, basic_format_context<@\placeholder{fmt-iter-for}@<charT>>>;
15758
15761
\end{codeblock}
15759
15762
15760
15763
\pnum
16947
16950
const char_type*, basic_string_view<char_type>,
16948
16951
const void*, handle> value; // \expos
16949
16952
16950
- template<class T> explicit basic_format_arg(T&& v) noexcept; // \expos
16951
- explicit basic_format_arg(float n) noexcept; // \expos
16952
- explicit basic_format_arg(double n) noexcept; // \expos
16953
- explicit basic_format_arg(long double n) noexcept; // \expos
16954
- explicit basic_format_arg(const char_type* s); // \expos
16955
-
16956
- template<class traits>
16957
- explicit basic_format_arg(
16958
- basic_string_view<char_type, traits> s) noexcept; // \expos
16959
-
16960
- template<class traits, class Allocator>
16961
- explicit basic_format_arg(
16962
- const basic_string<char_type, traits, Allocator>& s) noexcept; // \expos
16963
-
16964
- explicit basic_format_arg(nullptr_t) noexcept; // \expos
16965
-
16966
- template<class T>
16967
- explicit basic_format_arg(T* p) noexcept; // \expos
16953
+ template<class T> explicit basic_format_arg(T& v) noexcept; // \expos
16968
16954
16969
16955
public:
16970
16956
basic_format_arg() noexcept;
@@ -16994,142 +16980,74 @@
16994
16980
\end{itemdescr}
16995
16981
16996
16982
\begin{itemdecl}
16997
- template<class T> explicit basic_format_arg(T&& v) noexcept;
16983
+ template<class T> explicit basic_format_arg(T& v) noexcept;
16998
16984
\end{itemdecl}
16999
16985
17000
16986
\begin{itemdescr}
17001
16987
\pnum
17002
16988
\constraints
17003
- The template specialization
17004
- \begin{codeblock}
17005
- typename Context::template formatter_type<remove_cvref_t<T>>
17006
- \end{codeblock}
17007
- meets the \newoldconcept{BasicFormatter} requirements\iref{formatter.requirements}.
17008
- The extent to which an implementation determines that
17009
- the specialization meets the \newoldconcept{BasicFormatter} requirements
17010
- is unspecified,
17011
- except that as a minimum the expression
17012
- \begin{codeblock}
17013
- typename Context::template formatter_type<remove_cvref_t<T>>()
17014
- .format(declval<T&>(), declval<Context&>())
17015
- \end{codeblock}
17016
- shall be well-formed when treated as an unevaluated operand\iref{term.unevaluated.operand}.
16989
+ \tcode{T} satisfies \tcode{\exposconcept{formattable-with}<Context>}.
16990
+
16991
+ \pnum
16992
+ \expects
16993
+ If \tcode{decay_t<T>} is \tcode{char_type*} or \tcode{const char_type*},
16994
+ \tcode{static_cast<const char_\linebreak{}type*>(v)} points to a NTCTS\iref{defns.ntcts}.
17017
16995
17018
16996
\pnum
17019
16997
\effects
16998
+ Let \tcode{TD} be \tcode{remove_const_t<T>}.
17020
16999
\begin{itemize}
17021
17000
\item
17022
- if \tcode{T } is \tcode{bool} or \tcode{char_type},
17001
+ If \tcode{TD } is \tcode{bool} or \tcode{char_type},
17023
17002
initializes \tcode{value} with \tcode{v};
17024
17003
\item
17025
- otherwise, if \tcode{T } is \tcode{char} and \tcode{char_type} is
17004
+ otherwise, if \tcode{TD } is \tcode{char} and \tcode{char_type} is
17026
17005
\keyword{wchar_t}, initializes \tcode{value} with
17027
17006
\tcode{static_cast<wchar_t>(v)};
17028
17007
\item
17029
- otherwise, if \tcode{T } is a signed integer type\iref{basic.fundamental}
17030
- and \tcode{sizeof(T ) <= sizeof(int)},
17008
+ otherwise, if \tcode{TD } is a signed integer type\iref{basic.fundamental}
17009
+ and \tcode{sizeof(TD ) <= sizeof(int)},
17031
17010
initializes \tcode{value} with \tcode{static_cast<int>(v)};
17032
17011
\item
17033
- otherwise, if \tcode{T } is an unsigned integer type and
17034
- \tcode{sizeof(T ) <= sizeof(unsigned int)}, initializes
17012
+ otherwise, if \tcode{TD } is an unsigned integer type and
17013
+ \tcode{sizeof(TD ) <= sizeof(unsigned int)}, initializes
17035
17014
\tcode{value} with \tcode{static_cast<unsigned int>(v)};
17036
17015
\item
17037
- otherwise, if \tcode{T } is a signed integer type and
17038
- \tcode{sizeof(T ) <= sizeof(long long int)}, initializes
17016
+ otherwise, if \tcode{TD } is a signed integer type and
17017
+ \tcode{sizeof(TD ) <= sizeof(long long int)}, initializes
17039
17018
\tcode{value} with \tcode{static_cast<long long int>(v)};
17040
17019
\item
17041
- otherwise, if \tcode{T } is an unsigned integer type and
17042
- \tcode{sizeof(T ) <= sizeof(unsigned long long int)}, initializes
17020
+ otherwise, if \tcode{TD } is an unsigned integer type and
17021
+ \tcode{sizeof(TD ) <= sizeof(unsigned long long int)}, initializes
17043
17022
\tcode{value} with
17044
17023
\tcode{static_cast<unsigned long long int>(v)};
17045
17024
\item
17025
+ otherwise, if \tcode{TD} is a standard floating-point type,
17026
+ initializes \tcode{value} with \tcode{v};
17027
+ \item
17028
+ otherwise, if \tcode{TD} is
17029
+ a specialization of \tcode{basic_string_view} or \tcode{basic_string} and
17030
+ \tcode{TD::value_type} is \tcode{char_type},
17031
+ initializes \tcode{value} with
17032
+ \tcode{basic_string_view<char_type>(v.data(), v.size())};
17033
+ \item
17034
+ otherwise, if \tcode{decay_t<TD>} is
17035
+ \tcode{char_type*} or \tcode{const char_type*},
17036
+ initializes \tcode{value} with \tcode{static_cast<const char_type*>(v)};
17037
+ \item
17038
+ otherwise, if \tcode{is_void_v<remove_pointer_t<TD>>} is \tcode{true} or
17039
+ \tcode{is_null_pointer_v<TD>} is \tcode{true},
17040
+ initializes \tcode{value} with \tcode{static_cast<const void*>(v)};
17041
+ \item
17046
17042
otherwise, initializes \tcode{value} with \tcode{handle(v)}.
17047
17043
\end{itemize}
17048
- \end{itemdescr}
17049
-
17050
- \begin{itemdecl}
17051
- explicit basic_format_arg(float n) noexcept;
17052
- explicit basic_format_arg(double n) noexcept;
17053
- explicit basic_format_arg(long double n) noexcept;
17054
- \end{itemdecl}
17055
-
17056
- \begin{itemdescr}
17057
- \pnum
17058
- \effects
17059
- Initializes \tcode{value} with \tcode{n}.
17060
- \end{itemdescr}
17061
-
17062
- \begin{itemdecl}
17063
- explicit basic_format_arg(const char_type* s);
17064
- \end{itemdecl}
17065
-
17066
- \begin{itemdescr}
17067
- \pnum
17068
- \expects
17069
- \tcode{s} points to a NTCTS\iref{defns.ntcts}.
17070
-
17071
- \pnum
17072
- \effects
17073
- Initializes \tcode{value} with \tcode{s}.
17074
- \end{itemdescr}
17075
-
17076
- \begin{itemdecl}
17077
- template<class traits>
17078
- explicit basic_format_arg(basic_string_view<char_type, traits> s) noexcept;
17079
- \end{itemdecl}
17080
-
17081
- \begin{itemdescr}
17082
- \pnum
17083
- \effects
17084
- Initializes \tcode{value} with
17085
- \tcode{basic_string_view<char_type>(s.data(), s.size())}.
17086
- \end{itemdescr}
17087
-
17088
- \begin{itemdecl}
17089
- template<class traits, class Allocator>
17090
- explicit basic_format_arg(
17091
- const basic_string<char_type, traits, Allocator>& s) noexcept;
17092
- \end{itemdecl}
17093
-
17094
- \begin{itemdescr}
17095
- \pnum
17096
- \effects
17097
- Initializes \tcode{value} with
17098
- \tcode{basic_string_view<char_type>(s.data(), s.size())}.
17099
- \end{itemdescr}
17100
-
17101
- \begin{itemdecl}
17102
- explicit basic_format_arg(nullptr_t) noexcept;
17103
- \end{itemdecl}
17104
-
17105
- \begin{itemdescr}
17106
- \pnum
17107
- \effects
17108
- Initializes \tcode{value} with
17109
- \tcode{static_cast<const void*>(nullptr)}.
17110
- \end{itemdescr}
17111
-
17112
- \begin{itemdecl}
17113
- template<class T> explicit basic_format_arg(T* p) noexcept;
17114
- \end{itemdecl}
17115
-
17116
- \begin{itemdescr}
17117
- \pnum
17118
- \constraints
17119
- \tcode{is_void_v<T>} is \tcode{true}.
17120
-
17121
- \pnum
17122
- \effects
17123
- Initializes \tcode{value} with \tcode{p}.
17124
-
17125
- \pnum
17126
17044
\begin{note}
17127
- Constructing \tcode{basic_format_arg} from
17128
- a pointer to a member is ill-formed unless
17129
- the user provides an enabled specialization of
17130
- \tcode{formatter} for that pointer to member type.
17045
+ Constructing \tcode{basic_format_arg} from a pointer to a member is ill-formed
17046
+ unless the user provides an enabled specialization of \tcode{formatter}
17047
+ for that pointer to member type.
17131
17048
\end{note}
17132
17049
\end{itemdescr}
17050
+
17133
17051
\indexlibrary{\idxcode{basic_format_arg}!constructor|)}%
17134
17052
17135
17053
\indexlibrarymember{operator bool}{basic_format_arg}%
17156
17074
void (*format_)(basic_format_parse_context<char_type>&,
17157
17075
Context&, const void*); // \expos
17158
17076
17159
- template<class T> explicit handle(T&& val) noexcept; // \expos
17077
+ template<class T> explicit handle(T& val) noexcept; // \expos
17160
17078
17161
17079
friend class basic_format_arg<Context>; // \expos
17162
17080
@@ -17168,27 +17086,24 @@
17168
17086
17169
17087
\indexlibraryctor{basic_format_arg::handle}%
17170
17088
\begin{itemdecl}
17171
- template<class T> explicit handle(T&& val) noexcept;
17089
+ template<class T> explicit handle(T& val) noexcept;
17172
17090
\end{itemdecl}
17173
17091
17174
17092
\begin{itemdescr}
17175
17093
\pnum
17176
17094
Let
17177
17095
\begin{itemize}
17178
17096
\item
17179
- \tcode{TD} be \tcode{remove_cvref_t<T>},
17180
- \item
17181
- \exposid{const-formattable} be \tcode{true} if
17182
- \tcode{typename Context::template formatter_type<TD>()\newline .format(declval<const TD\&>(), declval<Context\&>())} is well-formed, otherwise \tcode{false},
17097
+ \tcode{TD} be \tcode{remove_const_t<T>},
17183
17098
\item
17184
- \tcode{TQ} be \tcode{const TD} if \exposid{const-formattable} is \tcode{true}
17099
+ \tcode{TQ} be \tcode{const TD} if
17100
+ \tcode{const TD} satisfies \tcode{\exposconcept{formattable-with}<Context>}
17185
17101
and \tcode{TD} otherwise.
17186
17102
\end{itemize}
17187
17103
17188
17104
\pnum
17189
17105
\mandates
17190
- \tcode{\exposid{const-formattable} || !is_const_v<remove_reference_t<T>>} is
17191
- \tcode{true}.
17106
+ \tcode{TQ} satisfies \tcode{\exposconcept{formattable-with}<Context>}.
17192
17107
17193
17108
\pnum
17194
17109
\effects
17253
17168
\pnum
17254
17169
\expects
17255
17170
The type
17256
- \tcode{typename Context::template formatter_type<}$\tcode{T}_i$\tcode{>}
17171
+ \tcode{typename Context::template formatter_type<remove_cvref_t< }$\tcode{T}_i$\tcode{>>}\linebreak{ }
17257
17172
meets the \newoldconcept{BasicFormatter} requirements\iref{formatter.requirements}
17258
17173
for each $\tcode{T}_i$ in \tcode{Args}.
17259
17174
0 commit comments