|
6086 | 6086 | // \ref{vector.bool}, class \tcode{vector<bool>}
|
6087 | 6087 | template<class Allocator> class vector<bool, Allocator>;
|
6088 | 6088 |
|
| 6089 | + template<class T> |
| 6090 | + inline constexpr bool @\exposid{is-vector-bool-reference}@ = @\seebelow@; // \expos |
| 6091 | + |
| 6092 | + template<class T, class charT> requires @\exposid{is-vector-bool-reference}@<T> |
| 6093 | + struct formatter<T, charT>; |
| 6094 | + |
6089 | 6095 | // hash support
|
6090 | 6096 | template<class T> struct hash;
|
6091 | 6097 | template<class Allocator> struct hash<vector<bool, Allocator>>;
|
|
9279 | 9285 | The specialization is enabled\iref{unord.hash}.
|
9280 | 9286 | \end{itemdescr}
|
9281 | 9287 |
|
| 9288 | +\indexlibraryglobal{\exposid{is-vector-bool-reference}}% |
| 9289 | +\begin{itemdecl} |
| 9290 | +template<class R> |
| 9291 | + inline constexpr bool @\exposid{is-vector-bool-reference}@ = @\seebelow@; |
| 9292 | +\end{itemdecl} |
| 9293 | + |
| 9294 | +\begin{itemdescr} |
| 9295 | +\pnum |
| 9296 | +The variable template |
| 9297 | +\tcode{\exposid{is-vector-bool-reference}<T>} is \tcode{true} |
| 9298 | +if \tcode{T} denotes the type \tcode{vector<bool, Alloc>::reference} |
| 9299 | +for some type \tcode{Alloc} and |
| 9300 | +\tcode{vector<bool, Alloc>} is not a program-defined specialization. |
| 9301 | +\end{itemdescr} |
| 9302 | + |
| 9303 | +% FIXME: Where are these codeblocks supposed to be part of? |
| 9304 | +\indexlibraryglobal{formatter}% |
| 9305 | +\begin{codeblock} |
| 9306 | +template<class T, class charT> requires is-vector-bool-reference<T> |
| 9307 | + struct formatter<T, charT> { |
| 9308 | + private: |
| 9309 | + formatter<bool, charT> @\exposid{underlying_}@; // \expos |
| 9310 | + |
| 9311 | + public: |
| 9312 | + template<class ParseContext> |
| 9313 | + constexpr typename ParseContext::iterator |
| 9314 | + parse(ParseContext& ctx); |
| 9315 | + |
| 9316 | + template<class FormatContext> |
| 9317 | + typename FormatContext::iterator |
| 9318 | + format(const T& ref, FormatContext& ctx) const; |
| 9319 | + }; |
| 9320 | +\end{codeblock} |
| 9321 | + |
| 9322 | +\indexlibrarymember{parse}{formatter}% |
| 9323 | +\begin{itemdecl} |
| 9324 | +template<class ParseContext> |
| 9325 | + constexpr typename ParseContext::iterator |
| 9326 | + parse(ParseContext& ctx); |
| 9327 | +\end{itemdecl} |
| 9328 | + |
| 9329 | +\begin{itemdescr} |
| 9330 | +\pnum |
| 9331 | +Equivalent to: \tcode{return \exposid{underlying_}.parse(ctx)}; |
| 9332 | +\end{itemdescr} |
| 9333 | + |
| 9334 | +\indexlibrarymember{format}{formatter}% |
| 9335 | +\begin{itemdecl} |
| 9336 | +template<class FormatContext> |
| 9337 | + typename FormatContext::iterator |
| 9338 | + format(const T& ref, FormatContext& ctx) const; |
| 9339 | +\end{itemdecl} |
| 9340 | + |
| 9341 | +\begin{itemdescr} |
| 9342 | +\pnum |
| 9343 | +Equivalent to: \tcode{return \exposid{underlying_}.format(ref, ctx)}; |
| 9344 | +\end{itemdescr} |
| 9345 | + |
9282 | 9346 | \rSec1[associative]{Associative containers}
|
9283 | 9347 |
|
9284 | 9348 | \rSec2[associative.general]{In general}
|
@@ -12953,6 +13017,155 @@
|
12953 | 13017 | \end{codeblock}
|
12954 | 13018 | \end{itemdescr}
|
12955 | 13019 |
|
| 13020 | +\rSec1[assoc.format]{Associative formatting} |
| 13021 | + |
| 13022 | +\pnum |
| 13023 | +For each of |
| 13024 | +\tcode{map}, |
| 13025 | +\tcode{multimap}, |
| 13026 | +\tcode{unordered_map}, and |
| 13027 | +\tcode{unordered_multimap}, |
| 13028 | +the library provides the following formatter specialization |
| 13029 | +where \placeholder{map-type} is the name of the template: |
| 13030 | + |
| 13031 | +\indexlibraryglobal{formatter}% |
| 13032 | +\begin{codeblock} |
| 13033 | +namespace std { |
| 13034 | + template<class charT, class Key, @\libconcept{formattable}@<charT> T, class... U> |
| 13035 | + requires @\libconcept{formattable}@<const Key, charT> |
| 13036 | + struct formatter<@\placeholder{map-type}@<Key, T, U...>, charT> { |
| 13037 | + private: |
| 13038 | + using @\exposid{maybe-const-map}@ = // \expos |
| 13039 | + @\exposid{fmt-maybe-const}@<@\placeholder{map-type}@<Key, T, U...>, charT>; |
| 13040 | + range_formatter<remove_cvref_t<ranges::range_reference_t<@\exposid{maybe-const-map}@>>, |
| 13041 | + charT> @\exposid{underlying_}@; // \expos |
| 13042 | + public: |
| 13043 | + constexpr formatter(); |
| 13044 | + |
| 13045 | + template<class ParseContext> |
| 13046 | + constexpr typename ParseContext::iterator |
| 13047 | + parse(ParseContext& ctx); |
| 13048 | + |
| 13049 | + template<class FormatContext> |
| 13050 | + typename FormatContext::iterator |
| 13051 | + format(@\exposid{maybe-const-map}@& r, FormatContext& ctx) const; |
| 13052 | + }; |
| 13053 | +} |
| 13054 | +\end{codeblock} |
| 13055 | + |
| 13056 | +\indexlibraryctor{formatter}% |
| 13057 | +\begin{itemdecl} |
| 13058 | +constexpr formatter(); |
| 13059 | +\end{itemdecl} |
| 13060 | + |
| 13061 | +\begin{itemdescr} |
| 13062 | +\pnum |
| 13063 | +\effects |
| 13064 | +Equivalent to: |
| 13065 | +\begin{codeblock} |
| 13066 | +@\exposid{underlying_}@.set_brackets(@\exposid{STATICALLY-WIDEN}@<charT>("{"), @\exposid{STATICALLY-WIDEN}@<charT>("}")); |
| 13067 | +@\exposid{underlying_}@.underlying().set_brackets({}, {}); |
| 13068 | +@\exposid{underlying_}@.underlying().set_separator(@\exposid{STATICALLY-WIDEN}@<charT>(": ")); |
| 13069 | +\end{codeblock} |
| 13070 | +\end{itemdescr} |
| 13071 | + |
| 13072 | +\indexlibrarymember{parse}{formatter}% |
| 13073 | +\begin{itemdecl} |
| 13074 | +template<class ParseContext> |
| 13075 | + constexpr typename ParseContext::iterator |
| 13076 | + parse(ParseContext& ctx); |
| 13077 | +\end{itemdecl} |
| 13078 | + |
| 13079 | +\begin{itemdescr} |
| 13080 | +\pnum |
| 13081 | +\effects |
| 13082 | +Equivalent to: \tcode{return \exposid{underlying_}.parse(ctx);} |
| 13083 | +\end{itemdescr} |
| 13084 | + |
| 13085 | +\indexlibrarymember{format}{formatter}% |
| 13086 | +\begin{itemdecl} |
| 13087 | +template<class FormatContext> |
| 13088 | + typename FormatContext::iterator |
| 13089 | + format(@\exposid{maybe-const-map}@& r, FormatContext& ctx) const; |
| 13090 | +\end{itemdecl} |
| 13091 | + |
| 13092 | +\begin{itemdescr} |
| 13093 | +\pnum |
| 13094 | +\effects |
| 13095 | +Equivalent to: \tcode{return \exposid{underlying_}.format(r, ctx);} |
| 13096 | +\end{itemdescr} |
| 13097 | + |
| 13098 | +\pnum |
| 13099 | +For each of |
| 13100 | +\tcode{set}, |
| 13101 | +\tcode{multiset}, |
| 13102 | +\tcode{nordered_set}, and |
| 13103 | +\tcode{nordered_multiset}, |
| 13104 | +the library provides the following formatter specialization |
| 13105 | +where \placeholder{set-type} is the name of the template: |
| 13106 | + |
| 13107 | +\indexlibraryglobal{formatter}% |
| 13108 | +\begin{codeblock} |
| 13109 | +namespace std { |
| 13110 | +template<class charT, class Key, class... U> |
| 13111 | + requires @\libconcept{formattable}@<const Key, charT> |
| 13112 | + struct formatter<@\placeholder{set-type}@<Key, U...>, charT> { |
| 13113 | + private: |
| 13114 | + range_formatter<Key, charT> @\exposid{underlying_}@; // \expos |
| 13115 | + public: |
| 13116 | + constexpr formatter(); |
| 13117 | + |
| 13118 | + template<class ParseContext> |
| 13119 | + constexpr typename ParseContext::iterator |
| 13120 | + parse(ParseContext& ctx); |
| 13121 | + |
| 13122 | + template<class FormatContext> |
| 13123 | + typename FormatContext::iterator |
| 13124 | + format(const @\placeholder{set-type}@<Key, U...>& r, FormatContext& ctx) const; |
| 13125 | + }; |
| 13126 | +} |
| 13127 | +\end{codeblock} |
| 13128 | + |
| 13129 | +\indexlibraryctor{formatter}% |
| 13130 | +\begin{itemdecl} |
| 13131 | +constexpr formatter(); |
| 13132 | +\end{itemdecl} |
| 13133 | + |
| 13134 | +\begin{itemdescr} |
| 13135 | +\pnum |
| 13136 | +\effects |
| 13137 | +Equivalent to: |
| 13138 | +\begin{codeblock} |
| 13139 | +@\exposid{underlying_}@.set_brackets(@\exposid{STATICALLY-WIDEN}@<charT>("{"), @\exposid{STATICALLY-WIDEN}@<charT>("}")); |
| 13140 | +\end{codeblock} |
| 13141 | +\end{itemdescr} |
| 13142 | + |
| 13143 | +\indexlibrarymember{parse}{formatter}% |
| 13144 | +\begin{itemdecl} |
| 13145 | +template<class ParseContext> |
| 13146 | + constexpr typename ParseContext::iterator |
| 13147 | + parse(ParseContext& ctx); |
| 13148 | +\end{itemdecl} |
| 13149 | + |
| 13150 | +\begin{itemdescr} |
| 13151 | +\pnum |
| 13152 | +\effects |
| 13153 | +Equivalent to: \tcode{return \exposid{underlying_}.parse(ctx);} |
| 13154 | +\end{itemdescr} |
| 13155 | + |
| 13156 | +\indexlibrarymember{format}{formatter}% |
| 13157 | +\begin{itemdecl} |
| 13158 | +template<class FormatContext> |
| 13159 | + typename FormatContext::iterator |
| 13160 | + format(const @\placeholder{set-type}@<Key, U...>& r, FormatContext& ctx) const; |
| 13161 | +\end{itemdecl} |
| 13162 | + |
| 13163 | +\begin{itemdescr} |
| 13164 | +\pnum |
| 13165 | +\effects |
| 13166 | +Equivalent to: \tcode{return \exposid{underlying_}.format(r, ctx);} |
| 13167 | +\end{itemdescr} |
| 13168 | + |
12956 | 13169 | \rSec1[container.adaptors]{Container adaptors}
|
12957 | 13170 |
|
12958 | 13171 | \rSec2[container.adaptors.general]{In general}
|
|
14292 | 14505 | As if by \tcode{x.swap(y)}.
|
14293 | 14506 | \end{itemdescr}
|
14294 | 14507 |
|
| 14508 | +\rSec2[container.adaptors.format]{Container adapters formatting} |
| 14509 | + |
| 14510 | +\pnum |
| 14511 | +For each of |
| 14512 | +\tcode{queue}, |
| 14513 | +\tcode{priority_queue}, and |
| 14514 | +\tcode{stack}, |
| 14515 | +the library provides the following formatter specialization |
| 14516 | +where \placeholder{adaptor-type} is the name of the template: |
| 14517 | + |
| 14518 | +\indexlibraryglobal{formatter}% |
| 14519 | +\begin{codeblock} |
| 14520 | +namespace std { |
| 14521 | + template<class charT, class T, @\libconcept{formattable}@<charT> Container, class... U> |
| 14522 | + struct formatter<adaptor-type<T, Container, U...>, charT> { |
| 14523 | + private: |
| 14524 | + using @\exposid{maybe-const-adaptor}@ = // \expos |
| 14525 | + @\exposid{fmt-maybe-const}@<adaptor-type<T, Container, U...>, charT>; |
| 14526 | + formatter<Container, charT> @\exposid{underlying_}@; // \expos |
| 14527 | + |
| 14528 | + public: |
| 14529 | + template<class ParseContext> |
| 14530 | + constexpr typename ParseContext::iterator |
| 14531 | + parse(ParseContext& ctx); |
| 14532 | + |
| 14533 | + template<class FormatContext> |
| 14534 | + typename FormatContext::iterator |
| 14535 | + format(@\exposid{maybe-const-adaptor}@& r, FormatContext& ctx) const; |
| 14536 | + }; |
| 14537 | +} |
| 14538 | +\end{codeblock} |
| 14539 | + |
| 14540 | +\indexlibrarymember{parse}{formatter}% |
| 14541 | +\begin{itemdecl} |
| 14542 | +template<class ParseContext> |
| 14543 | + constexpr typename ParseContext::iterator |
| 14544 | + parse(ParseContext& ctx); |
| 14545 | +\end{itemdecl} |
| 14546 | + |
| 14547 | +\begin{itemdescr} |
| 14548 | +\pnum |
| 14549 | +\effects |
| 14550 | +Equivalent to: \tcode{return \exposid{underlying_}.parse(ctx);} |
| 14551 | +\end{itemdescr} |
| 14552 | + |
| 14553 | +\indexlibrarymember{format}{formatter}% |
| 14554 | +\begin{itemdecl} |
| 14555 | +template<class FormatContext> |
| 14556 | + typename FormatContext::iterator |
| 14557 | + format(@\exposid{maybe-const-adaptor}@& r, FormatContext& ctx) const; |
| 14558 | +\end{itemdecl} |
| 14559 | + |
| 14560 | +\begin{itemdescr} |
| 14561 | +\pnum |
| 14562 | +\effects |
| 14563 | +Equivalent to: \tcode{return \exposid{underlying_}.format(r, ctx);} |
| 14564 | +\end{itemdescr} |
| 14565 | + |
14295 | 14566 | \rSec1[views]{Views}
|
14296 | 14567 |
|
14297 | 14568 | \rSec2[views.general]{General}
|
|
0 commit comments