-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrange-default-formatter.html
More file actions
383 lines (320 loc) · 21 KB
/
range-default-formatter.html
File metadata and controls
383 lines (320 loc) · 21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
<!doctype html>
<html class="cpprefjp" lang="ja" itemscope="" itemtype="http://schema.org/WebPage">
<head>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-NXNBNVBTJS"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-NXNBNVBTJS');
</script>
<meta charset="UTF-8">
<title>range-default-formatter - cpprefjp C++日本語リファレンス</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="keywords" content="
C++,標準ライブラリ,リファレンス,ドキュメント,STL,std,,format,class template,std,cpp23
">
<meta name="title" content="range-default-formatter - cpprefjp C++日本語リファレンス" />
<meta itemprop="name" content="range-default-formatter - cpprefjp C++日本語リファレンス" />
<meta property="og:title" content="range-default-formatter - cpprefjp C++日本語リファレンス" />
<meta property="og:url" content="https://cpprefjp.github.io/reference/format/range-default-formatter.html" />
<meta property="og:site_name" content="cpprefjp - C++日本語リファレンス" />
<meta property="og:type" content="article" />
<meta property="og:description" content="`range-default-formatter`は、Range・コンテナに対するデフォルトの書式解析と書式文字列化を行う説明専用クラスである。" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:title" content="range-default-formatter - cpprefjp C++日本語リファレンス" />
<meta name="twitter:url" content="https://cpprefjp.github.io/reference/format/range-default-formatter.html" />
<meta name="twitter:description" content="`range-default-formatter`は、Range・コンテナに対するデフォルトの書式解析と書式文字列化を行う説明専用クラスである。" />
<link rel="alternate" type="application/atom+xml" title="Atom" href="https://cpprefjp.github.io/rss.xml" />
<link rel="apple-touch-icon" sizes="180x180" href="../../static/favicons/apple-touch-icon.png?cachebust=be86fa2321ebe02b6955b61b98b778e377bcbf95">
<link rel="icon" type="image/png" sizes="32x32" href="../../static/favicons/favicon-32x32.png?cachebust=be86fa2321ebe02b6955b61b98b778e377bcbf95">
<link rel="icon" type="image/png" sizes="16x16" href="../../static/favicons/favicon-16x16.png?cachebust=be86fa2321ebe02b6955b61b98b778e377bcbf95">
<link rel="manifest" href="../../manifest.json?cachebust=be86fa2321ebe02b6955b61b98b778e377bcbf95">
<meta name="theme-color" content="#f5f8fc">
<link rel="stylesheet" href="../../static/pygments/default.css?cachebust=be86fa2321ebe02b6955b61b98b778e377bcbf95">
<!-- <link rel="stylesheet" href="../../static/css/root.css"> -->
<link href="../../static/kunai/css/kunai-stage-0.css?cachebust=be86fa2321ebe02b6955b61b98b778e377bcbf95" rel="stylesheet">
<link href="../../static/kunai/css/kunai-stage-1.css?cachebust=be86fa2321ebe02b6955b61b98b778e377bcbf95" rel="stylesheet">
<link href="../../static/kunai/css/kunai-stage-2.css?cachebust=be86fa2321ebe02b6955b61b98b778e377bcbf95" rel="stylesheet">
<link href="../../static/kunai/css/kunai-stage-3.css?cachebust=be86fa2321ebe02b6955b61b98b778e377bcbf95" rel="stylesheet">
<script type="text/javascript" src="../../static/kunai/js/kunai-vendor.js?cachebust=be86fa2321ebe02b6955b61b98b778e377bcbf95"></script>
<script type="text/javascript" src="../../static/kunai/js/kunai.js?cachebust=be86fa2321ebe02b6955b61b98b778e377bcbf95"></script>
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', function() {
var kn = new Kunai;
kn.cpprefjp();
});
</script>
</head>
<body>
<header data-kunai-mdinfo="{"meta": {"exposition-only": [""], "header": ["format"], "id-type": ["class template"], "namespace": ["std"], "cpp": ["cpp23"]}, "sources": [], "page_id": ["reference", "format", "range-default-formatter"]}">
<nav class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../../index.html">
<div class="title-wrapper clearfix">
<div class="title">cpprefjp - C++日本語リファレンス</div>
</div>
</a>
</div>
<div class="collapse navbar-collapse" id="navbar-collapse">
<ul class="nav navbar-nav navbar-right">
<li>
<div class="google-search">
<script>
(function() {
var cx = '013316413321391058734:ji_u66hl7hq';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
'//www.google.com/cse/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
</script>
<div class="gcse-search"></div>
</div>
</li>
<li>
<a href="https://github.com/cpprefjp/site">GitHub Project</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<main id="main" role="main">
<div class="container-fluid">
<div class="row">
<div class="col-sm-9 col-sm-push-3" itemscope itemtype="http://schema.org/Article">
<div class="row">
<div class="col-sm-12 google-search-result">
<gcse:searchresults></gcse:searchresults>
</div>
</div>
<div class="row">
<div class="col-sm-12 content-header">
<ol class="breadcrumb">
<li itemscope itemtype="http://www.schema.org/SiteNavigationElement">
<span>
<a href="../../index.html" itemprop="url">
<i class="fa fa-fw fa-home"></i>
</a>
</span>
</li>
<li itemscope itemtype="http://www.schema.org/SiteNavigationElement">
<span>
<a href="../../reference.html" itemprop="url">
<span itemprop="name">リファレンス</span>
</a>
</span>
</li>
<li itemscope itemtype="http://www.schema.org/SiteNavigationElement">
<span>
<a href="../../reference/format.html" itemprop="url">
<span itemprop="name">format</span>
</a>
</span>
</li>
<li class="active" itemscope itemtype="http://www.schema.org/SiteNavigationElement">
<span>
<span itemprop="name">range-default-formatter</span>
</span>
</li>
</ol>
<div class="crsearch"></div>
</div>
</div>
<div class="row">
<div class="col-sm-12 edit-button">
<p class="text-right"><small>
最終更新日時(UTC):
<span itemprop="datePublished" content="2026-02-08T09:00:28">
2026年02月08日 09時00分28秒
</span>
<br/>
<span itemprop="author" itemscope itemtype="http://schema.org/Person">
<span itemprop="name">yoh</span>
</span>
が更新
</small></p>
<p class="text-right">
<a class="history" target="_blank" href="https://github.com/cpprefjp/site/commits/master/reference/format/range-default-formatter.md">
<span class="fa fa-fw fa-clock-o fa-flip-horizontal"></span>履歴
</a>
<a class="edit" target="_blank" href="https://github.com/cpprefjp/site/edit/master/reference/format/range-default-formatter.md">
<span class="fa fa-fw fa-pencil"></span>編集
</a>
</p>
</div>
</div>
<div class="row">
<div class="col-sm-12 content-body">
<div class="identifier-type">class template</div><div class="header"><format></div><h1 class="exposition-only" itemprop="name"><span class="namespace" title="namespace std">std::</span><span class="token">range-default-formatter</span><span class="cpp cpp23" title="C++23で追加">(C++23)</span><span class="cpp exposition-only" title="説明専用"></span></h1>
<div itemprop="articleBody"><p><div class="codehilite"><pre><span></span><code><span class="k">namespace</span><span class="w"> </span><span class="nn">std</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="k">template</span><span class="w"> </span><span class="o"><</span><span class="n"><a href="range_format.html">range_format</a></span><span class="w"> </span><span class="n">K</span><span class="p">,</span><span class="w"> </span><span class="n"><a href="../ranges/input_range.html">ranges::input_range</a></span><span class="w"> </span><span class="n">R</span><span class="p">,</span><span class="w"> </span><span class="k">class</span><span class="w"> </span><span class="nc">charT</span><span class="o">></span>
<span class="w"> </span><span class="k">struct</span><span class="w"> </span><span class="nc"><a href="../ranges/range.html">range</a></span><span class="o">-</span><span class="k">default</span><span class="o">-</span><span class="n">formatter</span><span class="p">;</span><span class="w"> </span><span class="c1">// (1) C++23</span>
<span class="w"> </span><span class="k">template</span><span class="w"> </span><span class="o"><</span><span class="n"><a href="../ranges/input_range.html">ranges::input_range</a></span><span class="w"> </span><span class="n">R</span><span class="p">,</span><span class="w"> </span><span class="k">class</span><span class="w"> </span><span class="nc">charT</span><span class="o">></span>
<span class="w"> </span><span class="k">struct</span><span class="w"> </span><span class="nc"><a href="../ranges/range.html">range</a></span><span class="o">-</span><span class="k">default</span><span class="o">-</span><span class="n">formatter</span><span class="o"><</span>
<span class="w"> </span><span class="n"><a href="range_format.html">range_format</a></span><span class="o">::</span><span class="n">sequence</span><span class="p">,</span><span class="w"> </span><span class="n">R</span><span class="p">,</span><span class="w"> </span><span class="n">charT</span><span class="o">></span><span class="p">;</span><span class="w"> </span><span class="c1">// (2) C++23</span>
<span class="w"> </span><span class="k">template</span><span class="w"> </span><span class="o"><</span><span class="n"><a href="../ranges/input_range.html">ranges::input_range</a></span><span class="w"> </span><span class="n">R</span><span class="p">,</span><span class="w"> </span><span class="k">class</span><span class="w"> </span><span class="nc">charT</span><span class="o">></span>
<span class="w"> </span><span class="k">struct</span><span class="w"> </span><span class="nc"><a href="../ranges/range.html">range</a></span><span class="o">-</span><span class="k">default</span><span class="o">-</span><span class="n">formatter</span><span class="o"><</span>
<span class="w"> </span><span class="n"><a href="range_format.html">range_format</a></span><span class="o">::</span><span class="n">map</span><span class="p">,</span><span class="w"> </span><span class="n">R</span><span class="p">,</span><span class="w"> </span><span class="n">charT</span><span class="o">></span><span class="p">;</span><span class="w"> </span><span class="c1">// (3) C++23</span>
<span class="w"> </span><span class="k">template</span><span class="w"> </span><span class="o"><</span><span class="n"><a href="../ranges/input_range.html">ranges::input_range</a></span><span class="w"> </span><span class="n">R</span><span class="p">,</span><span class="w"> </span><span class="k">class</span><span class="w"> </span><span class="nc">charT</span><span class="o">></span>
<span class="w"> </span><span class="k">struct</span><span class="w"> </span><span class="nc"><a href="../ranges/range.html">range</a></span><span class="o">-</span><span class="k">default</span><span class="o">-</span><span class="n">formatter</span><span class="o"><</span>
<span class="w"> </span><span class="n"><a href="range_format.html">range_format</a></span><span class="o">::</span><span class="n">set</span><span class="p">,</span><span class="w"> </span><span class="n">R</span><span class="p">,</span><span class="w"> </span><span class="n">charT</span><span class="o">></span><span class="p">;</span><span class="w"> </span><span class="c1">// (4) C++23</span>
<span class="w"> </span><span class="k">template</span><span class="w"> </span><span class="o"><</span><span class="n"><a href="range_format.html">range_format</a></span><span class="w"> </span><span class="n">K</span><span class="p">,</span><span class="w"> </span><span class="n"><a href="../ranges/input_range.html">ranges::input_range</a></span><span class="w"> </span><span class="n">R</span><span class="p">,</span><span class="w"> </span><span class="k">class</span><span class="w"> </span><span class="nc">charT</span><span class="o">></span>
<span class="w"> </span><span class="k">requires</span><span class="w"> </span><span class="p">(</span><span class="n">K</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n"><a href="range_format.html">range_format</a></span><span class="o">::</span><span class="n">string</span><span class="w"> </span><span class="o">||</span><span class="w"> </span><span class="n">K</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n"><a href="range_format.html">range_format</a></span><span class="o">::</span><span class="n">debug_string</span><span class="p">)</span>
<span class="w"> </span><span class="k">struct</span><span class="w"> </span><span class="nc"><a href="../ranges/range.html">range</a></span><span class="o">-</span><span class="k">default</span><span class="o">-</span><span class="n">formatter</span><span class="o"><</span>
<span class="w"> </span><span class="n">K</span><span class="p">,</span><span class="w"> </span><span class="n">R</span><span class="p">,</span><span class="w"> </span><span class="n">charT</span><span class="o">></span><span class="p">;</span><span class="w"> </span><span class="c1">// (5) C++23</span>
<span class="p">}</span>
</code></pre></div>
</p>
<h2>概要</h2>
<p><code>range-default-formatter</code>は、Range・コンテナに対するデフォルトの書式解析と書式文字列化を行う説明専用クラスである。</p>
<p>このクラスは、<code><a href="formatter.html">formatter</a></code>クラスのRange・コンテナに対する特殊化実装として標準ライブラリの内部で使用される。</p>
<p>このクラスの内部実装として<code><a href="range_formatter.html">range_formatter</a></code>が使用される。</p>
<ul>
<li>(1) : プライマリテンプレート。宣言のみ</li>
<li>(2) : Range・シーケンスコンテナに対する特殊化。デバッグ出力の有効化と、<code>[a, b, c]</code>形式の出力を行う</li>
<li>(3) : <code><a href="../map/map.html">std::map</a></code>や<code><a href="../flat_map/flat_map.html">std::flat_map</a></code>などの連想コンテナに対する特殊化。デバッグ出力の有効化と、<code>{1: a, 2: b}</code>形式での出力を行う</li>
<li>(4) : <code><a href="../set/set.html">std::set</a></code>や<code><a href="../flat_set/flat_set.html">std::flat_set</a></code>などの集合コンテナに対する特殊化。デバッグ出力の有効化と、<code>{a, b, c}</code>形式の出力を行う</li>
<li>(5) : 文字列形式の出力を行うRangeに対する特殊化。Rangeを文字列として出力し、<code><a href="range_format.html">range_format::debug_string</a></code>指定であればデバッグ文字列として出力する</li>
</ul>
<h2>備考</h2>
<ul>
<li>(5) : この特殊化は規格上、標準ライブラリ内では使用されないが (<code><a href="formatter.html">formatter</a><<a href="../string/basic_string.html">string</a>, charT></code>がすでにある)、以下のような用途が考えられる<ul>
<li><a class="cpprefjp-defined-word" data-desc="プログラム定義。ユーザー(プログラマ)によって定義されること(標準ライブラリで定義されるものを除く)">ユーザー定義</a>の文字列クラスを定義する場合に、<code><a href="format_kind.html">format_kind</a></code>で値として<code><a href="range_format.html">range_format::string</a></code>もしくは<code><a href="range_format.html">range_format::debug_string</a></code>をもつよう特殊化するか (<code><a href="formatter.html">formatter</a><<a href="../string/basic_string.html">string</a>, charT></code>をラップする方がかんたんではある)</li>
<li><code><a href="../vector/vector.html">std::vector<char></a></code>のような文字を要素とするシーケンスコンテナで、文字列形式で出力する書式オプション (<a href="format.html#range-format-options"><code>s</code>や<code>?s</code></a>) を指定した際に<code>range-default-formatter<range_format::sequence, R, charT></code>の内部で使用される</li>
</ul>
</li>
</ul>
<h2>メンバ関数</h2>
<table border="1" bordercolor="#888" style="border-collapse:collapse">
<thead>
<tr>
<th>メンバ関数</th>
<th>説明</th>
<th>対応バージョン</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>parse</code></td>
<td>書式の解析を行う</td>
<td>C++23</td>
</tr>
<tr>
<td><code>format</code></td>
<td>書式化を行う</td>
<td>C++23</td>
</tr>
</tbody>
</table>
<h3>sequenceに対する特殊化</h3>
<table border="1" bordercolor="#888" style="border-collapse:collapse">
<thead>
<tr>
<th>メンバ関数</th>
<th>説明</th>
<th>対応バージョン</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>constexpr void set_separator(basic_string_view<charT> sep);</code></td>
<td>要素の区切り文字を設定する</td>
<td>C++23</td>
</tr>
<tr>
<td><code>constexpr void set_brackets(basic_string_view<charT> opening, basic_string_view<charT> closing);</code></td>
<td>全体の囲み文字を設定する</td>
<td>C++23</td>
</tr>
</tbody>
</table>
<h3>mapに対する特殊化</h3>
<table border="1" bordercolor="#888" style="border-collapse:collapse">
<thead>
<tr>
<th>メンバ関数</th>
<th>説明</th>
<th>対応バージョン</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>constexpr range-default-formatter();</code></td>
<td>全体の囲み文字を<code>{}</code>、要素の囲み文字を空、要素同士の区切り文字を<code>": "</code>に設定する</td>
<td>C++23</td>
</tr>
</tbody>
</table>
<h3>setに対する特殊化</h3>
<table border="1" bordercolor="#888" style="border-collapse:collapse">
<thead>
<tr>
<th>メンバ関数</th>
<th>説明</th>
<th>対応バージョン</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>constexpr range-default-formatter();</code></td>
<td>全体の囲み文字を<code>{}</code>に設定する</td>
<td>C++23</td>
</tr>
</tbody>
</table>
<h2>バージョン</h2>
<h3>言語</h3>
<ul>
<li>C++23</li>
</ul>
<h3>処理系</h3>
<ul>
<li><a href="../../implementation.html#clang">Clang</a>: ??</li>
<li><a href="../../implementation.html#gcc">GCC</a>: ??</li>
<li><a href="../../implementation.html#icc">ICC</a>: ??</li>
<li><a href="../../implementation.html#visual_cpp">Visual C++</a>: ??</li>
</ul>
<h2>参照</h2>
<ul>
<li><a href="https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2286r8.html" target="_blank">P2286R8 Formatting Ranges</a></li>
<li><a href="https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2585r1.html" target="_blank">P2585R1 Improve default container formatting</a><ul>
<li>C++23から、Range・コンテナ、<code>pair</code>、<code>tuple</code>のフォーマット出力、および文字・文字列のデバッグ指定 (<code>"?"</code>) が追加された</li>
</ul>
</li>
<li><a href="https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3391r2.html" target="_blank">P3391R2 <code>constexpr std::format</code></a><ul>
<li>C++26から<code>constexpr</code>に対応した</li>
</ul>
</li>
</ul></div>
</div>
</div>
</div>
<div id="sidebar" class="col-sm-3 col-sm-pull-9">
</div>
</div>
</div>
</main>
<footer class="footer navbar navbar-default">
<div class="container-fluid">
<p><small>
本サイトの情報は、
<a href="https://creativecommons.org/licenses/by/4.0/deed.ja" rel="nofollow">クリエイティブ・コモンズ 表示 4.0 非移植 ライセンス(CC BY)</a>
の下に提供されています。
</small></p>
</div>
</footer>
</body>
</html>