-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathforward_list.html
More file actions
851 lines (768 loc) · 46 KB
/
Copy pathforward_list.html
File metadata and controls
851 lines (768 loc) · 46 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
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
<!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>std::forward_list - cpprefjp C++日本語リファレンス</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="keywords" content="
C++,標準ライブラリ,リファレンス,ドキュメント,STL,std,forward_list,std,class template,cpp11
">
<meta name="title" content="std::forward_list - cpprefjp C++日本語リファレンス" />
<meta itemprop="name" content="std::forward_list - cpprefjp C++日本語リファレンス" />
<meta property="og:title" content="std::forward_list - cpprefjp C++日本語リファレンス" />
<meta property="og:url" content="https://cpprefjp.github.io/reference/forward_list/forward_list.html" />
<meta property="og:site_name" content="cpprefjp - C++日本語リファレンス" />
<meta property="og:type" content="article" />
<meta property="og:description" content="`forward_list`は、単方向リンクリストのデータ構造をもつクラスである。" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:title" content="std::forward_list - cpprefjp C++日本語リファレンス" />
<meta name="twitter:url" content="https://cpprefjp.github.io/reference/forward_list/forward_list.html" />
<meta name="twitter:description" content="`forward_list`は、単方向リンクリストのデータ構造をもつクラスである。" />
<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=557cd0469f26f0f797224f46d1b6e764266f07cc">
<link rel="icon" type="image/png" sizes="32x32" href="../../static/favicons/favicon-32x32.png?cachebust=557cd0469f26f0f797224f46d1b6e764266f07cc">
<link rel="icon" type="image/png" sizes="16x16" href="../../static/favicons/favicon-16x16.png?cachebust=557cd0469f26f0f797224f46d1b6e764266f07cc">
<link rel="manifest" href="../../manifest.json?cachebust=557cd0469f26f0f797224f46d1b6e764266f07cc">
<meta name="theme-color" content="#f5f8fc">
<link rel="stylesheet" href="../../static/pygments/default.css?cachebust=557cd0469f26f0f797224f46d1b6e764266f07cc">
<!-- <link rel="stylesheet" href="../../static/css/root.css"> -->
<link href="../../static/kunai/css/kunai-stage-0.css?cachebust=557cd0469f26f0f797224f46d1b6e764266f07cc" rel="stylesheet">
<link href="../../static/kunai/css/kunai-stage-1.css?cachebust=557cd0469f26f0f797224f46d1b6e764266f07cc" rel="stylesheet">
<link href="../../static/kunai/css/kunai-stage-2.css?cachebust=557cd0469f26f0f797224f46d1b6e764266f07cc" rel="stylesheet">
<link href="../../static/kunai/css/kunai-stage-3.css?cachebust=557cd0469f26f0f797224f46d1b6e764266f07cc" rel="stylesheet">
<script type="text/javascript" src="../../static/kunai/js/kunai-vendor.js?cachebust=557cd0469f26f0f797224f46d1b6e764266f07cc"></script>
<script type="text/javascript" src="../../static/kunai/js/kunai.js?cachebust=557cd0469f26f0f797224f46d1b6e764266f07cc"></script>
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', function() {
var kn = new Kunai;
kn.cpprefjp();
});
</script>
</head>
<body>
<header data-kunai-mdinfo="{"meta": {"header": ["forward_list"], "namespace": ["std"], "id-type": ["class template"], "cpp": ["cpp11"]}, "sources": [{"id": "62631f4cc139fe002cfd3f94e70c19fff00e1291", "source": "#include <iostream>\n#include <forward_list>\n#include <algorithm>\n#include <utility>\n\nint main()\n{\n std::forward_list<int> ls;\n\n ls.push_front(3); // \u5148\u982d\u306b3\u3092\u8ffd\u52a0\n ls.insert_after(ls.begin(), 1); // \u5148\u982d\u306e\u5f8c\u308d\u306b1\u3092\u8ffd\u52a0\n\n // \u30a4\u30c6\u30ec\u30fc\u30bf\u3092\u4ecb\u3057\u3066\u5168\u8981\u7d20\u306b\u5bfe\u3057\u3066\u64cd\u4f5c\u3092\u884c\u3046\n std::for_each(ls.cbegin(), ls.cend(), [](int x) {\n std::cout << x << std::endl;\n });\n}\n"}, {"id": "a4992378a5813cdccb5749675c968b78ed0de5fe", "source": "#include <iostream>\n#include <forward_list>\n#include <string>\n#include <utility>\n\n//\u7c21\u6613\u306a\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u69cb\u9020\u8868\u73fe\u30af\u30e9\u30b9\n//forward_list\u306e\u7279\u6027\u4e0a\u51fa\u529b\u304c\u9006\u9806\u306b\u306a\u308b\nclass directory {\n\n //\u4e0d\u5b8c\u5168\u578b\uff08\u30af\u30e9\u30b9\u5b9a\u7fa9\u5185\u3067\u306f\u305d\u306e\u30af\u30e9\u30b9\u81ea\u8eab\u306f\u4e0d\u5b8c\u5168\uff09\u3092\u8981\u7d20\u578b\u306b\u6307\u5b9a\n std::forward_list<directory> m_subdir{};\n std::string m_name{};\n\npublic:\n\n directory(const char* name) : m_name{name}\n {}\n\n //\u30b5\u30d6\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u8ffd\u52a0\n template<typename Dir>\n void add(Dir&& dir) {\n m_subdir.emplace_front(std::forward<Dir>(dir));\n }\n\n //\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u540d\u53d6\u5f97\n auto get() const -> const std::string& {\n return m_name;\n }\n\n auto begin() const {\n return m_subdir.begin();\n }\n\n auto end() const {\n return m_subdir.end();\n }\n};\n\n//\u30eb\u30fc\u30c8\u3088\u308a\u4e0b\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u3064\u3044\u3066\u6574\u5f62\u3057\u3066\u51fa\u529b\nvoid recursive_out(const directory& dir, unsigned int depth) {\n\n if (1 < depth) std::cout << \"| \";\n for (auto i = depth; 2 < i; --i) {\n std::cout << \" \";\n }\n if (2 < depth) std::cout << \" \";\n\n std::cout << \"|-\" << dir.get() << std::endl;\n\n for (auto& subdir : dir) {\n recursive_out(subdir, depth + 1);\n }\n}\n\n//\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u69cb\u9020\u3092\u51fa\u529b\u3059\u308b\nvoid out_directorytree(const directory& dir) {\n std::cout << dir.get() << std::endl;\n\n for (auto& subdir : dir) {\n recursive_out(subdir, 1);\n }\n}\n\nint main() {\n directory dir{\"root\"};\n dir.add(\"sub1\");\n\n directory sub2{\"sub2\"};\n sub2.add(\"sub2.1\");\n\n directory sub22{\"sub2.2\"};\n sub22.add(\"sub2.2.1\");\n\n sub2.add(std::move(sub22));\n\n dir.add(std::move(sub2));\n dir.add(\"sub3\");\n\n out_directorytree(dir);\n}\n"}], "page_id": ["reference", "forward_list", "forward_list"]}">
<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/forward_list.html" itemprop="url">
<span itemprop="name">forward_list</span>
</a>
</span>
</li>
<li class="active" itemscope itemtype="http://www.schema.org/SiteNavigationElement">
<span>
<span itemprop="name">forward_list</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>
最終更新日時:
<time itemprop="datePublished" class="js-local-time"
datetime="2026-07-22T16:08:23+09:00">
2026年07月22日 16時08分23秒 (JST)
</time>
<br/>
<span itemprop="author" itemscope itemtype="http://schema.org/Person">
<span itemprop="name">rotarymars</span>
</span>
が更新
</small></p>
<script>
(function () {
// 最終更新日時を閲覧者のローカルタイムゾーンで表示し直す (issue #53 の正規化)。
// JS が無効な環境ではサーバ生成の JST 表記がそのまま残る。
function pad(n) { return (n < 10 ? '0' : '') + n; }
var els = document.querySelectorAll('time.js-local-time[datetime]');
for (var i = 0; i < els.length; i++) {
var el = els[i];
var d = new Date(el.getAttribute('datetime'));
if (isNaN(d.getTime())) { continue; }
var tz = '';
try {
var parts = new Intl.DateTimeFormat(undefined, { timeZoneName: 'short' }).formatToParts(d);
for (var j = 0; j < parts.length; j++) {
if (parts[j].type === 'timeZoneName') { tz = parts[j].value; break; }
}
} catch (e) {}
el.textContent = d.getFullYear() + '年' + pad(d.getMonth() + 1) + '月' + pad(d.getDate()) + '日 '
+ pad(d.getHours()) + '時' + pad(d.getMinutes()) + '分' + pad(d.getSeconds()) + '秒'
+ (tz ? ' (' + tz + ')' : '');
}
})();
</script>
<p class="text-right">
<a class="history" target="_blank" href="https://github.com/cpprefjp/site/commits/master/reference/forward_list/forward_list.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/forward_list/forward_list.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"><forward_list></div><h1 itemprop="name"><span class="namespace" title="namespace std">std::</span><span class="token">forward_list</span><span class="cpp cpp11" title="C++11で追加">(C++11)</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="k">class</span><span class="w"> </span><span class="nc">T</span><span class="p">,</span><span class="w"> </span><span class="k">class</span><span class="w"> </span><span class="nc">Allocator</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n"><a href="../memory/allocator.html">allocator</a></span><span class="o"><</span><span class="n">T</span><span class="o">>></span>
<span class="w"> </span><span class="k">class</span><span class="w"> </span><span class="nc">forward_list</span><span class="p">;</span>
<span class="w"> </span><span class="k">namespace</span><span class="w"> </span><span class="nn">pmr</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="k">class</span><span class="w"> </span><span class="nc">T</span><span class="o">></span>
<span class="w"> </span><span class="k">using</span><span class="w"> </span><span class="n">forward_list</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n"><a href="">std::forward_list</a></span><span class="o"><</span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="n"><a href="../memory_resource/polymorphic_allocator.html">polymorphic_allocator</a></span><span class="o"><</span><span class="n">T</span><span class="o">>></span><span class="p">;</span><span class="w"> </span><span class="c1">// C++17から</span>
<span class="w"> </span><span class="p">}</span>
<span class="p">}</span>
</code></pre></div>
</p>
<h2>概要</h2>
<p><code>forward_list</code>は、単方向リンクリストのデータ構造をもつクラスである。</p>
<p><code>forward_list</code>は、標準ライブラリではシーケンスコンテナの一種として定義されるが、いくつかの点でシーケンスコンテナの要件を満たさない:</p>
<ul>
<li>
<p><code>size()</code>メンバ関数を提供しない。</p>
<ul>
<li><code>size()</code>メンバ関数は全てのコンテナにO(1)<a class="cpprefjp-defined-word" data-desc="関数等の意味論を構成する要素の1つ。Complexity。関数が使うアルゴリズムの空間計算量・時間計算量">計算量</a>を要求するため、単方向リストの実装ではサイズのためのメンバ変数が必要になる。<code>forward_list</code>では、サイズメンバ変数を内部に持たないことを示すために<code>size()</code>メンバ関数は提供しない。要素数が必要な場合は<code><a href="../iterator/distance.html">distance()</a></code>を使用して取得する。</li>
</ul>
</li>
<li>
<p><code>insert()/emplace()/erase()</code>メンバ関数を提供しない。</p>
<ul>
<li>双方向リンクリストである<code><a href="../list/list.html">list</a></code>の<code><a href="../list/list/insert.html">insert()</a></code>/<code><a href="../list/list/emplace.html">emplace()</a></code>/<code><a href="../list/list/erase.html">erase()</a></code>はinsert-before方式をとっておりO(1)<a class="cpprefjp-defined-word" data-desc="関数等の意味論を構成する要素の1つ。Complexity。関数が使うアルゴリズムの空間計算量・時間計算量">計算量</a>だが、単方向リストの典型的なinsert-beforeの実装ではO(N)<a class="cpprefjp-defined-word" data-desc="関数等の意味論を構成する要素の1つ。Complexity。関数が使うアルゴリズムの空間計算量・時間計算量">計算量</a>になってしまう。</li>
<li><code>forward_list</code>では、単方向リンクリストでO(1)<a class="cpprefjp-defined-word" data-desc="関数等の意味論を構成する要素の1つ。Complexity。関数が使うアルゴリズムの空間計算量・時間計算量">計算量</a>であるinsert-after方式を使用することを示す<code><a href="forward_list/insert_after.html">insert_after()</a></code>/<code><a href="forward_list/emplace_after.html">emplace_after()</a></code>/<code><a href="forward_list/erase_after.html">erase_after()</a></code>メンバ関数を提供する。先頭に挿入するために<code><a href="forward_list/before_begin.html">before_begin()</a></code>メンバ関数を提供する。</li>
</ul>
</li>
</ul>
<p><code>forward_list</code>は、C言語で単方向リンクリストを実装する場合と比べ、空間的にもパフォーマンス的にもゼロオーバーヘッドであるよう設計されている。<br />
また、<code>forward_list</code>はリンクリストの性質上、挿入・削除のような破壊的操作を行なってもイテレータは無効にならない。</p>
<p>各テンプレートパラメータの意味は次の通りである。</p>
<ul>
<li><code>T</code>: 格納される要素の型、C++17以降は<a class="cpprefjp-defined-word" data-desc="型のサイズを決定できない、完全には定義されていない型。例えば先行宣言のみのクラス型、要素数不明の配列型、`void`など。クラス定義内部ではそのクラス自身は不完全型">不完全型</a>をサポートしている</li>
<li><code>Allocator</code>: メモリ確保に使用されるアロケータの型。無指定の場合は標準の<code><a href="../memory/allocator.html">allocator</a></code>クラスが使用される。</li>
</ul>
<h2>メンバ関数</h2>
<h3>構築/コピー/破棄</h3>
<table border="1" bordercolor="#888" style="border-collapse:collapse">
<thead>
<tr>
<th>名前</th>
<th>説明</th>
<th>対応バージョン</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="forward_list/op_constructor.html">(constructor)</a></code></td>
<td>コンストラクタ</td>
<td>C++11</td>
</tr>
<tr>
<td><code><a href="forward_list/op_destructor.html">(destructor)</a></code></td>
<td>デストラクタ</td>
<td>C++11</td>
</tr>
<tr>
<td><code><a href="forward_list/op_assign.html">operator=</a></code></td>
<td>代入演算子</td>
<td>C++11</td>
</tr>
<tr>
<td><code><a href="forward_list/assign.html">assign</a></code></td>
<td>コンテナの再代入</td>
<td>C++11</td>
</tr>
<tr>
<td><code><a href="forward_list/assign_range.html">assign_range</a></code></td>
<td>Rangeの要素を再代入</td>
<td>C++23</td>
</tr>
</tbody>
</table>
<h3>イテレータ</h3>
<table border="1" bordercolor="#888" style="border-collapse:collapse">
<thead>
<tr>
<th>名前</th>
<th>説明</th>
<th>対応バージョン</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="forward_list/before_begin.html">before_begin</a></code></td>
<td>先頭要素の前を指すイテレータを取得する</td>
<td>C++11</td>
</tr>
<tr>
<td><code><a href="forward_list/begin.html">begin</a></code></td>
<td>先頭要素を指すイテレータを取得する</td>
<td>C++11</td>
</tr>
<tr>
<td><code><a href="forward_list/end.html">end</a></code></td>
<td>末尾の次を指すイテレータを取得する</td>
<td>C++11</td>
</tr>
<tr>
<td><code><a href="forward_list/cbegin.html">cbegin</a></code></td>
<td>先頭要素を指す読み取り専用イテレータを取得する</td>
<td>C++11</td>
</tr>
<tr>
<td><code><a href="forward_list/cbefore_begin.html">cbefore_begin</a></code></td>
<td>先頭要素の前を指す読み取り専用イテレータを取得する</td>
<td>C++11</td>
</tr>
<tr>
<td><code><a href="forward_list/cend.html">cend</a></code></td>
<td>末尾の次を指す読み取り専用イテレータを取得する</td>
<td>C++11</td>
</tr>
</tbody>
</table>
<h3>領域</h3>
<table border="1" bordercolor="#888" style="border-collapse:collapse">
<thead>
<tr>
<th>名前</th>
<th>説明</th>
<th>対応バージョン</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="forward_list/empty.html">empty</a></code></td>
<td>コンテナが空かどうかを判定する</td>
<td>C++11</td>
</tr>
<tr>
<td><code><a href="forward_list/max_size.html">max_size</a></code></td>
<td>格納可能な最大の要素数を取得する</td>
<td>C++11</td>
</tr>
</tbody>
</table>
<h3>要素アクセス</h3>
<table border="1" bordercolor="#888" style="border-collapse:collapse">
<thead>
<tr>
<th>名前</th>
<th>説明</th>
<th>対応バージョン</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="forward_list/front.html">front</a></code></td>
<td>先頭要素への参照を取得する</td>
<td>C++11</td>
</tr>
</tbody>
</table>
<h3>コンテナの変更</h3>
<table border="1" bordercolor="#888" style="border-collapse:collapse">
<thead>
<tr>
<th>名前</th>
<th>説明</th>
<th>対応バージョン</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="forward_list/emplace_front.html">emplace_front</a></code></td>
<td>先頭への直接構築による要素追加</td>
<td>C++11</td>
</tr>
<tr>
<td><code><a href="forward_list/push_front.html">push_front</a></code></td>
<td>先頭に要素を追加する</td>
<td>C++11</td>
</tr>
<tr>
<td><code><a href="forward_list/prepend_range.html">prepend_range</a></code></td>
<td>先頭にRangeの要素を追加する</td>
<td>C++23</td>
</tr>
<tr>
<td><code><a href="forward_list/pop_front.html">pop_front</a></code></td>
<td>先頭から要素を削除</td>
<td>C++11</td>
</tr>
<tr>
<td><code><a href="forward_list/emplace_after.html">emplace_after</a></code></td>
<td>任意の位置への直接構築による要素挿入</td>
<td>C++11</td>
</tr>
<tr>
<td><code><a href="forward_list/insert_after.html">insert_after</a></code></td>
<td>任意の位置への要素挿入</td>
<td>C++11</td>
</tr>
<tr>
<td><code><a href="forward_list/insert_range_after.html">insert_range_after</a></code></td>
<td>任意の位置へRangeの要素挿入</td>
<td>C++23</td>
</tr>
<tr>
<td><code><a href="forward_list/erase_after.html">erase_after</a></code></td>
<td>指定したイテレータの次の要素を削除する</td>
<td>C++11</td>
</tr>
<tr>
<td><code><a href="forward_list/swap.html">swap</a></code></td>
<td>コンテナの交換</td>
<td>C++11</td>
</tr>
<tr>
<td><code><a href="forward_list/resize.html">resize</a></code></td>
<td>要素数を変更する</td>
<td>C++11</td>
</tr>
<tr>
<td><code><a href="forward_list/clear.html">clear</a></code></td>
<td>全要素削除</td>
<td>C++11</td>
</tr>
</tbody>
</table>
<h3>単方向リスト操作</h3>
<table border="1" bordercolor="#888" style="border-collapse:collapse">
<thead>
<tr>
<th>名前</th>
<th>説明</th>
<th>対応バージョン</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="forward_list/splice_after.html">splice_after</a></code></td>
<td>他のコンテナから要素を移動する</td>
<td>C++11</td>
</tr>
<tr>
<td><code><a href="forward_list/remove.html">remove</a></code></td>
<td>コンテナから指定された値の要素を削除する</td>
<td>C++11</td>
</tr>
<tr>
<td><code><a href="forward_list/remove_if.html">remove_if</a></code></td>
<td>コンテナから条件に合った要素を削除する</td>
<td>C++11</td>
</tr>
<tr>
<td><code><a href="forward_list/unique.html">unique</a></code></td>
<td>重複した要素をコンテナから削除する</td>
<td>C++11</td>
</tr>
<tr>
<td><code><a href="forward_list/merge.html">merge</a></code></td>
<td>2つのコンテナを併合する</td>
<td>C++11</td>
</tr>
<tr>
<td><code><a href="forward_list/sort.html">sort</a></code></td>
<td>コンテナを並べ替える</td>
<td>C++11</td>
</tr>
<tr>
<td><code><a href="forward_list/reverse.html">reverse</a></code></td>
<td>コンテナを反転する</td>
<td>C++11</td>
</tr>
</tbody>
</table>
<h3>アロケータ</h3>
<table border="1" bordercolor="#888" style="border-collapse:collapse">
<thead>
<tr>
<th>名前</th>
<th>説明</th>
<th>対応バージョン</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="forward_list/get_allocator.html">get_allocator</a></code></td>
<td>アロケータオブジェクトの取得</td>
<td>C++11</td>
</tr>
</tbody>
</table>
<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>reference</code></td>
<td><code>T&</code></td>
<td>C++11</td>
</tr>
<tr>
<td><code>const_reference</code></td>
<td><code>const T&</code></td>
<td>C++11</td>
</tr>
<tr>
<td><code>iterator</code></td>
<td>前方向イテレータ</td>
<td>C++11</td>
</tr>
<tr>
<td><code>const_iterator</code></td>
<td>読み取り専用前方向イテレータ</td>
<td>C++11</td>
</tr>
<tr>
<td><code>size_type</code></td>
<td>符号なし整数型(通常は<code><a href="../cstddef/size_t.html">size_t</a></code>)</td>
<td>C++11</td>
</tr>
<tr>
<td><code>difference_type</code></td>
<td>符号付き整数型(通常は<code><a href="../cstddef/ptrdiff_t.html">ptrdiff_t</a></code>)</td>
<td>C++11</td>
</tr>
<tr>
<td><code>value_type</code></td>
<td><code>T</code></td>
<td>C++11</td>
</tr>
<tr>
<td><code>allocator_type</code></td>
<td><code>Allocator</code></td>
<td>C++11</td>
</tr>
<tr>
<td><code>pointer</code></td>
<td><code><a href="../memory/allocator_traits.html">allocator_traits</a><Allocator>::pointer</code></td>
<td>C++11</td>
</tr>
<tr>
<td><code>const_pointer</code></td>
<td><code><a href="../memory/allocator_traits.html">allocator_traits</a><Allocator>::const_pointer</code></td>
<td>C++11</td>
</tr>
</tbody>
</table>
<h2>非メンバ関数</h2>
<h3>比較演算子</h3>
<table border="1" bordercolor="#888" style="border-collapse:collapse">
<thead>
<tr>
<th>名前</th>
<th>説明</th>
<th>対応バージョン</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="forward_list/op_equal.html">operator==</a></code></td>
<td>等値比較</td>
<td>C++11</td>
</tr>
<tr>
<td><code><a href="forward_list/op_not_equal.html">operator!=</a></code></td>
<td>非等値比較</td>
<td>C++11</td>
</tr>
<tr>
<td><code><a href="forward_list/op_compare_3way.html">operator<=></a></code></td>
<td>三方比較</td>
<td>C++20</td>
</tr>
<tr>
<td><code><a href="forward_list/op_less.html">operator<</a></code></td>
<td>左辺が右辺より小さいかの判定を行う</td>
<td>C++11</td>
</tr>
<tr>
<td><code><a href="forward_list/op_less_equal.html">operator<=</a></code></td>
<td>左辺が右辺以下かの判定を行う</td>
<td>C++11</td>
</tr>
<tr>
<td><code><a href="forward_list/op_greater.html">operator></a></code></td>
<td>左辺が右辺より大きいかの判定を行う</td>
<td>C++11</td>
</tr>
<tr>
<td><code><a href="forward_list/op_greater_equal.html">operator>=</a></code></td>
<td>左辺が右辺以上かの判定を行う</td>
<td>C++11</td>
</tr>
</tbody>
</table>
<h3>入れ替え</h3>
<table border="1" bordercolor="#888" style="border-collapse:collapse">
<thead>
<tr>
<th>名前</th>
<th>説明</th>
<th>対応バージョン</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="forward_list/swap_free.html">swap</a></code></td>
<td>2つの<code>forward_list</code>オブジェクトを入れ替える</td>
<td>C++11</td>
</tr>
</tbody>
</table>
<h3>要素削除</h3>
<table border="1" bordercolor="#888" style="border-collapse:collapse">
<thead>
<tr>
<th>名前</th>
<th>説明</th>
<th>対応バージョン</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="forward_list/erase_free.html">erase</a></code></td>
<td>指定した値をもつ要素とその分の領域を、コンテナから削除する</td>
<td>C++20</td>
</tr>
<tr>
<td><code><a href="forward_list/erase_if_free.html">erase_if</a></code></td>
<td>指定した条件に合致する要素とその分の領域を、コンテナから削除する</td>
<td>C++20</td>
</tr>
</tbody>
</table>
<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><a href="forward_list/op_deduction_guide.html">(deduction_guide)</a></code></td>
<td>クラステンプレートの推論補助</td>
<td>C++17</td>
</tr>
</tbody>
</table>
<h2>例</h2>
<h3>基本的な使い方</h3>
<p><div class="yata" id="62631f4cc139fe002cfd3f94e70c19fff00e1291"><div class="codehilite"><pre><span></span><code><span class="cp">#include <a href="../iostream.html"><iostream></a></span>
<span class="cp">#include <a href="../forward_list.html"><forward_list></a></span>
<span class="cp">#include <a href="../algorithm.html"><algorithm></a></span>
<span class="cp">#include <a href="../utility.html"><utility></a></span>
<span class="kt">int</span><span class="w"> </span><span class="nf">main</span><span class="p">()</span>
<span class="p">{</span>
<span class="w"> </span><span class="n"><span style="color:#ff0000">std::forward_list</span></span><span class="o"><</span><span class="kt">int</span><span class="o">></span><span class="w"> </span><span class="n">ls</span><span class="p">;</span>
<span class="w"> </span><span class="n"><a href="forward_list/push_front.html">ls.push_front</a></span><span class="p">(</span><span class="mi">3</span><span class="p">);</span><span class="w"> </span><span class="c1">// 先頭に3を追加</span>
<span class="w"> </span><span class="n"><a href="forward_list/insert_after.html">ls.insert_after</a></span><span class="p">(</span><span class="n"><a href="forward_list/begin.html">ls.begin()</a></span><span class="p">,</span><span class="w"> </span><span class="mi">1</span><span class="p">);</span><span class="w"> </span><span class="c1">// 先頭の後ろに1を追加</span>
<span class="w"> </span><span class="c1">// イテレータを介して全要素に対して操作を行う</span>
<span class="w"> </span><span class="n"><a href="../algorithm/for_each.html">std::for_each</a></span><span class="p">(</span><span class="n"><a href="forward_list/cbegin.html">ls.cbegin()</a></span><span class="p">,</span><span class="w"> </span><span class="n"><a href="forward_list/cend.html">ls.cend()</a></span><span class="p">,</span><span class="w"> </span><span class="p">[](</span><span class="kt">int</span><span class="w"> </span><span class="n">x</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="n"><a href="../iostream/cout.html">std::cout</a></span><span class="w"> </span><span class="o"><<</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="o"><<</span><span class="w"> </span><span class="n"><a href="../ostream/endl.html">std::endl</a></span><span class="p">;</span>
<span class="w"> </span><span class="p">});</span>
<span class="p">}</span>
</code></pre></div>
</div></p>
<h4>出力</h4>
<p><pre><code>3
1
</code></pre></p>
<h3><a class="cpprefjp-defined-word" data-desc="型のサイズを決定できない、完全には定義されていない型。例えば先行宣言のみのクラス型、要素数不明の配列型、`void`など。クラス定義内部ではそのクラス自身は不完全型">不完全型</a>を要素にする例 (C++17)</h3>
<p><a class="cpprefjp-defined-word" data-desc="型のサイズを決定できない、完全には定義されていない型。例えば先行宣言のみのクラス型、要素数不明の配列型、`void`など。クラス定義内部ではそのクラス自身は不完全型">不完全型</a>を要素型に出来るようになった事で、階層構造や多分木などの再帰的データ構造を実装することが容易になる。<br />
他にも、<code><a href="../vector/vector.html">vector</a></code>と<code><a href="../list/list.html">list</a></code>が<a class="cpprefjp-defined-word" data-desc="型のサイズを決定できない、完全には定義されていない型。例えば先行宣言のみのクラス型、要素数不明の配列型、`void`など。クラス定義内部ではそのクラス自身は不完全型">不完全型</a>をサポートしている。</p>
<p><div class="yata" id="a4992378a5813cdccb5749675c968b78ed0de5fe"><div class="codehilite"><pre><span></span><code><span class="cp">#include <a href="../iostream.html"><iostream></a></span>
<span class="cp">#include <a href="../forward_list.html"><forward_list></a></span>
<span class="cp">#include <a href="../string.html"><string></a></span>
<span class="cp">#include <a href="../utility.html"><utility></a></span>
<span class="c1">//簡易なディレクトリ構造表現クラス</span>
<span class="c1">//forward_listの特性上出力が逆順になる</span>
<span class="k">class</span><span class="w"> </span><span class="nc">directory</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="c1">//不完全型(クラス定義内ではそのクラス自身は不完全)を要素型に指定</span>
<span class="w"> </span><span class="n"><span style="color:#ff0000">std::forward_list</span></span><span class="o"><</span><span class="n">directory</span><span class="o">></span><span class="w"> </span><span class="n">m_subdir</span><span class="p">{};</span>
<span class="w"> </span><span class="n"><a href="../string/basic_string.html">std::string</a></span><span class="w"> </span><span class="n">m_name</span><span class="p">{};</span>
<span class="k">public</span><span class="o">:</span>
<span class="w"> </span><span class="n">directory</span><span class="p">(</span><span class="k">const</span><span class="w"> </span><span class="kt">char</span><span class="o">*</span><span class="w"> </span><span class="n">name</span><span class="p">)</span><span class="w"> </span><span class="o">:</span><span class="w"> </span><span class="n">m_name</span><span class="p">{</span><span class="n">name</span><span class="p">}</span>
<span class="w"> </span><span class="p">{}</span>
<span class="w"> </span><span class="c1">//サブディレクトリ追加</span>
<span class="w"> </span><span class="k">template</span><span class="o"><</span><span class="k">typename</span><span class="w"> </span><span class="nc">Dir</span><span class="o">></span>
<span class="w"> </span><span class="kt">void</span><span class="w"> </span><span class="n">add</span><span class="p">(</span><span class="n">Dir</span><span class="o">&&</span><span class="w"> </span><span class="n">dir</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="n">m_subdir</span><span class="p">.</span><span class="n"><a href="forward_list/emplace_front.html">emplace_front</a></span><span class="p">(</span><span class="n"><a href="../utility/forward.html">std::forward</a></span><span class="o"><</span><span class="n">Dir</span><span class="o">></span><span class="p">(</span><span class="n">dir</span><span class="p">));</span>
<span class="w"> </span><span class="p">}</span>
<span class="w"> </span><span class="c1">//ディレクトリ名取得</span>
<span class="w"> </span><span class="k">auto</span><span class="w"> </span><span class="n">get</span><span class="p">()</span><span class="w"> </span><span class="k">const</span><span class="w"> </span><span class="o">-></span><span class="w"> </span><span class="k">const</span><span class="w"> </span><span class="n"><a href="../string/basic_string.html">std::string</a></span><span class="o">&</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="n">m_name</span><span class="p">;</span>
<span class="w"> </span><span class="p">}</span>
<span class="w"> </span><span class="k">auto</span><span class="w"> </span><span class="n"><a href="forward_list/begin.html">begin</a></span><span class="p">()</span><span class="w"> </span><span class="k">const</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="n">m_subdir</span><span class="p">.</span><span class="n"><a href="forward_list/begin.html">begin</a></span><span class="p">();</span>
<span class="w"> </span><span class="p">}</span>
<span class="w"> </span><span class="k">auto</span><span class="w"> </span><span class="n"><a href="forward_list/end.html">end</a></span><span class="p">()</span><span class="w"> </span><span class="k">const</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="n">m_subdir</span><span class="p">.</span><span class="n"><a href="forward_list/end.html">end</a></span><span class="p">();</span>
<span class="w"> </span><span class="p">}</span>
<span class="p">};</span>
<span class="c1">//ルートより下のディレクトリについて整形して出力</span>
<span class="kt">void</span><span class="w"> </span><span class="nf">recursive_out</span><span class="p">(</span><span class="k">const</span><span class="w"> </span><span class="n">directory</span><span class="o">&</span><span class="w"> </span><span class="n">dir</span><span class="p">,</span><span class="w"> </span><span class="kt">unsigned</span><span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="n">depth</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="mi">1</span><span class="w"> </span><span class="o"><</span><span class="w"> </span><span class="n">depth</span><span class="p">)</span><span class="w"> </span><span class="n"><a href="../iostream/cout.html">std::cout</a></span><span class="w"> </span><span class="o"><<</span><span class="w"> </span><span class="s">"| "</span><span class="p">;</span>
<span class="w"> </span><span class="n"><a href="../../lang/cpp11/range_based_for.html">for</a></span><span class="w"> </span><span class="p">(</span><span class="k">auto</span><span class="w"> </span><span class="n">i</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">depth</span><span class="p">;</span><span class="w"> </span><span class="mi">2</span><span class="w"> </span><span class="o"><</span><span class="w"> </span><span class="n">i</span><span class="p">;</span><span class="w"> </span><span class="o">--</span><span class="n">i</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="n"><a href="../iostream/cout.html">std::cout</a></span><span class="w"> </span><span class="o"><<</span><span class="w"> </span><span class="s">" "</span><span class="p">;</span>
<span class="w"> </span><span class="p">}</span>
<span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="mi">2</span><span class="w"> </span><span class="o"><</span><span class="w"> </span><span class="n">depth</span><span class="p">)</span><span class="w"> </span><span class="n"><a href="../iostream/cout.html">std::cout</a></span><span class="w"> </span><span class="o"><<</span><span class="w"> </span><span class="s">" "</span><span class="p">;</span>
<span class="w"> </span><span class="n"><a href="../iostream/cout.html">std::cout</a></span><span class="w"> </span><span class="o"><<</span><span class="w"> </span><span class="s">"|-"</span><span class="w"> </span><span class="o"><<</span><span class="w"> </span><span class="n">dir</span><span class="p">.</span><span class="n">get</span><span class="p">()</span><span class="w"> </span><span class="o"><<</span><span class="w"> </span><span class="n"><a href="../ostream/endl.html">std::endl</a></span><span class="p">;</span>
<span class="w"> </span><span class="n"><a href="../../lang/cpp11/range_based_for.html">for</a></span><span class="w"> </span><span class="p">(</span><span class="k">auto</span><span class="o">&</span><span class="w"> </span><span class="n">subdir</span><span class="w"> </span><span class="o">:</span><span class="w"> </span><span class="n">dir</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="n">recursive_out</span><span class="p">(</span><span class="n">subdir</span><span class="p">,</span><span class="w"> </span><span class="n">depth</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">1</span><span class="p">);</span>
<span class="w"> </span><span class="p">}</span>
<span class="p">}</span>
<span class="c1">//ディレクトリ構造を出力する</span>
<span class="kt">void</span><span class="w"> </span><span class="nf">out_directorytree</span><span class="p">(</span><span class="k">const</span><span class="w"> </span><span class="n">directory</span><span class="o">&</span><span class="w"> </span><span class="n">dir</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="n"><a href="../iostream/cout.html">std::cout</a></span><span class="w"> </span><span class="o"><<</span><span class="w"> </span><span class="n">dir</span><span class="p">.</span><span class="n">get</span><span class="p">()</span><span class="w"> </span><span class="o"><<</span><span class="w"> </span><span class="n"><a href="../ostream/endl.html">std::endl</a></span><span class="p">;</span>
<span class="w"> </span><span class="n"><a href="../../lang/cpp11/range_based_for.html">for</a></span><span class="w"> </span><span class="p">(</span><span class="k">auto</span><span class="o">&</span><span class="w"> </span><span class="n">subdir</span><span class="w"> </span><span class="o">:</span><span class="w"> </span><span class="n">dir</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="n">recursive_out</span><span class="p">(</span><span class="n">subdir</span><span class="p">,</span><span class="w"> </span><span class="mi">1</span><span class="p">);</span>
<span class="w"> </span><span class="p">}</span>
<span class="p">}</span>
<span class="kt">int</span><span class="w"> </span><span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="n">directory</span><span class="w"> </span><span class="n">dir</span><span class="p">{</span><span class="s">"root"</span><span class="p">};</span>
<span class="w"> </span><span class="n">dir</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="s">"sub1"</span><span class="p">);</span>
<span class="w"> </span><span class="n">directory</span><span class="w"> </span><span class="n">sub2</span><span class="p">{</span><span class="s">"sub2"</span><span class="p">};</span>
<span class="w"> </span><span class="n">sub2</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="s">"sub2.1"</span><span class="p">);</span>
<span class="w"> </span><span class="n">directory</span><span class="w"> </span><span class="n">sub22</span><span class="p">{</span><span class="s">"sub2.2"</span><span class="p">};</span>
<span class="w"> </span><span class="n">sub22</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="s">"sub2.2.1"</span><span class="p">);</span>
<span class="w"> </span><span class="n">sub2</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="n"><a href="../utility/move.html">std::move</a></span><span class="p">(</span><span class="n">sub22</span><span class="p">));</span>
<span class="w"> </span><span class="n">dir</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="n"><a href="../utility/move.html">std::move</a></span><span class="p">(</span><span class="n">sub2</span><span class="p">));</span>
<span class="w"> </span><span class="n">dir</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="s">"sub3"</span><span class="p">);</span>
<span class="w"> </span><span class="n">out_directorytree</span><span class="p">(</span><span class="n">dir</span><span class="p">);</span>
<span class="p">}</span>
</code></pre></div>
</div></p>
<h4>出力</h4>
<p><pre><code>root
|-sub3
|-sub2
| |-sub2.2
| |-sub2.2.1
| |-sub2.1
|-sub1
</code></pre></p>
<h2>バージョン</h2>
<h3>言語</h3>
<ul>
<li>C++11</li>
</ul>
<h3>処理系</h3>
<ul>
<li><a href="../../implementation.html#clang">Clang</a>: ??</li>
<li><a href="../../implementation.html#gcc">GCC</a>: 4.7.0 <span aria-label="検証済" role="img" title="検証済">✅</span></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="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2543.htm" target="_blank">N2543 STL singly linked lists (revision 3)</a> [<a href="http://faithandbrave.hateblo.jp/entry/20080905/1220611240" target="_blank">概要の日本語訳</a>]</li>
<li><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4510.html" target="_blank">N4510 Minimal incomplete type support for standard containers, revision 4</a></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>