File tree Expand file tree Collapse file tree 4 files changed +154
-2
lines changed Expand file tree Collapse file tree 4 files changed +154
-2
lines changed Original file line number Diff line number Diff line change @@ -129,7 +129,7 @@ namespace std {
129129
130130| 名前 | 説明 | 対応バージョン |
131131|------|------|----------------|
132- | [`swap`](flat_multiset/swap_free.md.nolink ) | 2つの`flat_multiset`オブジェクトを入れ替える | C++23 |
132+ | [`swap`](flat_multiset/swap_free.md) | 2つの`flat_multiset`オブジェクトを入れ替える | C++23 |
133133
134134
135135## 推論補助
Original file line number Diff line number Diff line change 1+ # swap (非メンバ関数)
2+ * flat_set[ meta header]
3+ * std[ meta namespace]
4+ * function template[ meta id-type]
5+ * cpp23[ meta cpp]
6+
7+ ``` cpp
8+ namespace std {
9+ template <class Key, class Compare, class KeyContainer>
10+ void swap(flat_multiset<Key, Compare, KeyContainer>& x,
11+ flat_multiset<Key, Compare, KeyContainer>& y); // (1) C++23
12+ }
13+ ```
14+
15+ ## 概要
16+ 2つの `flat_multiset` オブジェクトを入れ替える。
17+
18+
19+ ## 効果
20+ `x.`[`swap`](swap.md)`(y)`
21+
22+
23+ ## 例
24+ ```cpp example
25+ #include <flat_set>
26+ #include <iostream>
27+
28+ template <class Set>
29+ void print(const char* name, const Set& s)
30+ {
31+ std::cout << name << " : {";
32+
33+ bool first = true;
34+
35+ for (const auto& x : s) {
36+ if (first) {
37+ first = false;
38+ }
39+ else {
40+ std::cout << ", ";
41+ }
42+ std::cout << x;
43+ }
44+ std::cout << "}" << std::endl;
45+ }
46+
47+ int main()
48+ {
49+ std::flat_multiset<int> fs1 = {10, 20, 30};
50+
51+ std::flat_multiset<int> fs2 = {5, 15};
52+
53+ // fs1とfs2を入れ替える
54+ std::swap(fs1, fs2);
55+
56+ print("fs1", fs1);
57+ print("fs2", fs2);
58+ }
59+ ```
60+ * std::swap[ color ff0000]
61+
62+ ### 出力
63+ ```
64+ fs1 : {5, 15}
65+ fs2 : {10, 20, 30}
66+ ```
67+
68+
69+ ## バージョン
70+ ### 言語
71+ - C++23
72+
73+ ### 処理系
74+ - [ Clang] ( /implementation.md#clang ) : ??
75+ - [ GCC] ( /implementation.md#gcc ) : ??
76+ - [ Visual C++] ( /implementation.md#visual_cpp ) : ??
Original file line number Diff line number Diff line change @@ -129,7 +129,7 @@ namespace std {
129129
130130| 名前 | 説明 | 対応バージョン |
131131|------|------|----------------|
132- | [`swap`](flat_set/swap_free.md.nolink ) | 2つの`flat_set`オブジェクトを入れ替える | C++23 |
132+ | [`swap`](flat_set/swap_free.md) | 2つの`flat_set`オブジェクトを入れ替える | C++23 |
133133
134134
135135## 推論補助
Original file line number Diff line number Diff line change 1+ # swap (非メンバ関数)
2+ * flat_set[ meta header]
3+ * std[ meta namespace]
4+ * function template[ meta id-type]
5+ * cpp23[ meta cpp]
6+
7+ ``` cpp
8+ namespace std {
9+ template <class Key, class Compare, class KeyContainer>
10+ void swap(flat_set<Key, Compare, KeyContainer>& x,
11+ flat_set<Key, Compare, KeyContainer>& y); // (1) C++23
12+ }
13+ ```
14+
15+ ## 概要
16+ 2つの `flat_set` オブジェクトを入れ替える。
17+
18+
19+ ## 効果
20+ `x.`[`swap`](swap.md)`(y)`
21+
22+
23+ ## 例
24+ ```cpp example
25+ #include <flat_set>
26+ #include <iostream>
27+
28+ template <class Set>
29+ void print(const char* name, const Set& s)
30+ {
31+ std::cout << name << " : {";
32+
33+ bool first = true;
34+
35+ for (const auto& x : s) {
36+ if (first) {
37+ first = false;
38+ }
39+ else {
40+ std::cout << ", ";
41+ }
42+ std::cout << x;
43+ }
44+ std::cout << "}" << std::endl;
45+ }
46+
47+ int main()
48+ {
49+ std::flat_set<int> fs1 = {10, 20, 30};
50+
51+ std::flat_set<int> fs2 = {5, 15};
52+
53+ // fs1とfs2を入れ替える
54+ std::swap(fs1, fs2);
55+
56+ print("fs1", fs1);
57+ print("fs2", fs2);
58+ }
59+ ```
60+ * std::swap[ color ff0000]
61+
62+ ### 出力
63+ ```
64+ fs1 : {5, 15}
65+ fs2 : {10, 20, 30}
66+ ```
67+
68+
69+ ## バージョン
70+ ### 言語
71+ - C++23
72+
73+ ### 処理系
74+ - [ Clang] ( /implementation.md#clang ) : ??
75+ - [ GCC] ( /implementation.md#gcc ) : ??
76+ - [ Visual C++] ( /implementation.md#visual_cpp ) : ??
You can’t perform that action at this time.
0 commit comments