File tree 4 files changed +193
-3
lines changed 4 files changed +193
-3
lines changed Original file line number Diff line number Diff line change @@ -87,8 +87,8 @@ namespace std {
87
87
88
88
| 名前 | 説明 | 対応バージョン |
89
89
|-------------------------------------|----------------------------------------|----------------|
90
- | [`key_comp`](flat_map/key_comp.md.nolink ) | キー比較用の関数オブジェクトを取得する | C++23 |
91
- | [`value_comp`](flat_map/value_comp.md.nolink ) | 要素比較用の関数オブジェクトを取得する | C++23 |
90
+ | [`key_comp`](flat_map/key_comp.md) | キー比較用の関数オブジェクトを取得する | C++23 |
91
+ | [`value_comp`](flat_map/value_comp.md) | 要素比較用の関数オブジェクトを取得する | C++23 |
92
92
| [`keys`](flat_map/keys.md.nolink) | キーのコンテナを取得する | C++23 |
93
93
| [`values`](flat_map/values.md.nolink) | 値のコンテナを取得する | C++23 |
94
94
@@ -101,7 +101,7 @@ namespace std {
101
101
| `mapped_type` | 値の型。テンプレートパラメータ `T` | C++23 |
102
102
| `value_type` | 要素の型。[`std::pair`](/reference/utility/pair.md)`<key_type, mapped_type>` | C++23 |
103
103
| `key_compare` | キー値の大小関係を判定する二項述語の型。テンプレートパラメータ `Compare` | C++23 |
104
- | [`value_compare`](flat_map/value_compare.md.nolink ) | 要素値のキー部分で大小関係を判定する二項述語の型。入れ子クラス | C++23 |
104
+ | [`value_compare`](flat_map/value_compare.md) | 要素値のキー部分で大小関係を判定する二項述語の型。入れ子クラス | C++23 |
105
105
| `reference` | 要素への参照型。[`std::pair`](/reference/utility/pair.md)`<const key_type&, mapped_type&>` | C++23 |
106
106
| `const_reference` | 要素への`const`参照型。[`std::pair`](/reference/utility/pair.md)`<const key_type&, const mapped_type&>` | C++23 |
107
107
| `size_type` | 要素数を表す符号なし整数型 [`size_t`](/reference/cstddef/size_t.md) | C++23 |
Original file line number Diff line number Diff line change
1
+ # key_comp
2
+ * flat_map[ meta header]
3
+ * std[ meta namespace]
4
+ * flat_map[ meta class]
5
+ * function[ meta id-type]
6
+ * cpp23[ meta cpp]
7
+
8
+ ``` cpp
9
+ key_compare key_comp () const ; // C++23
10
+ ```
11
+
12
+
13
+ ## 概要
14
+ コンテナに関連づけられたキー比較用の関数オブジェクトを返す。このオブジェクトはコンテナ内の二つの要素のキー値を比較するために利用できる。
15
+ この比較オブジェクトはオブジェクトの構築時に与えられ、関数へのポインタでも関数オブジェクトでも良い。いずれの場合でも、これは同じ型の 2 つの引数をとり、[ 狭義の弱順序] ( /reference/algorithm.md#strict-weak-ordering ) に従って一つ目の引数が二つ目の引数より前のときに ` true ` を返し、そうでないときに ` false ` を返す。
16
+
17
+
18
+ ## 戻り値
19
+ 比較オブジェクト。` key_compare ` はメンバ型であり、テンプレートパラメータ ` Compare ` の別名として定義される。
20
+
21
+
22
+ ## 計算量
23
+ 定数時間。
24
+
25
+
26
+ ## 例
27
+ ``` cpp example
28
+ #include < flat_map>
29
+ #include < iostream>
30
+
31
+ int main ()
32
+ {
33
+ std::flat_map<int, char> m;
34
+ std::flat_map<int, char>::key_compare comp = m.key_comp();
35
+
36
+ std::cout << comp(1, 2) << std::endl;
37
+ std::cout << comp(3, 2) << std::endl;
38
+ }
39
+ ```
40
+ * key_comp()[ color ff0000]
41
+
42
+ ### 出力
43
+ ```
44
+ 1
45
+ 0
46
+ ```
47
+
48
+
49
+ ## バージョン
50
+ ### 言語
51
+ - C++23
52
+
53
+ ### 処理系
54
+ - [ Clang] ( /implementation.md#clang ) : ??
55
+ - [ GCC] ( /implementation.md#gcc ) : ??
56
+ - [ ICC] ( /implementation.md#icc ) : ??
57
+ - [ Visual C++] ( /implementation.md#visual_cpp ) : ??
58
+
59
+
60
+ ## 関連項目
61
+
62
+ | 名前 | 説明 |
63
+ | -------------------------------------| ----------------------------------------------------------|
64
+ | [ ` value_comp ` ] ( value_comp.md ) | 要素比較用の関数オブジェクトを返す |
65
+ | [ ` value_compare ` ] ( value_compare.md ) | 要素値のキー部分で大小関係を判定する二項述語の型 |
Original file line number Diff line number Diff line change
1
+ # value_comp
2
+ * flat_map[ meta header]
3
+ * std[ meta namespace]
4
+ * flat_map[ meta class]
5
+ * function[ meta id-type]
6
+ * cpp23[ meta cpp]
7
+
8
+ ``` cpp
9
+ value_compare value_comp () const ; // C++23
10
+ ```
11
+
12
+
13
+ ## 概要
14
+ コンテナに関連づけられた要素比較用の関数オブジェクトを返す。これはコンテナ内の二つの要素のキー部分を比較するために利用できる。
15
+ これは同じ型の 2 つの引数をとり、[ 狭義の弱順序] ( /reference/algorithm.md#strict-weak-ordering ) に従って一つ目の引数が二つ目の引数の前になる場合に ` true ` 、そうでない場合に ` false ` を返す。
16
+
17
+
18
+ ## 戻り値
19
+ 要素比較用の関数オブジェクト。
20
+ [ ` value_compare ` ] ( value_compare.md ) はメンバ型である。` key_compare ` とは異なり、単なる型の別名ではなく入れ子クラスである。
21
+
22
+
23
+ ## 計算量
24
+ 定数時間。
25
+
26
+
27
+ ## 例
28
+ ``` cpp example
29
+ #include < flat_map>
30
+ #include < iostream>
31
+ #include < utility>
32
+
33
+ int main ()
34
+ {
35
+ std::flat_map<int, char> m;
36
+ std::flat_map<int, char>::value_compare comp = m.value_comp();
37
+
38
+ auto p1 = std::make_pair(1, 'a');
39
+ auto p2 = std::make_pair(2, 'b');
40
+ auto p3 = std::make_pair(3, 'c');
41
+
42
+ std::cout << comp(p1, p2) << std::endl;
43
+ std::cout << comp(p3, p2) << std::endl;
44
+ }
45
+ ```
46
+ * value_comp()[ color ff0000]
47
+ * value_compare[ link value_compare.md]
48
+
49
+ ### 出力
50
+ ```
51
+ 1
52
+ 0
53
+ ```
54
+
55
+
56
+ ## バージョン
57
+ ### 言語
58
+ - C++23
59
+
60
+ ### 処理系
61
+ - [ Clang] ( /implementation.md#clang ) : ??
62
+ - [ GCC] ( /implementation.md#gcc ) : ??
63
+ - [ ICC] ( /implementation.md#icc ) : ??
64
+ - [ Visual C++] ( /implementation.md#visual_cpp ) : ??
65
+
66
+
67
+ ## 関連項目
68
+
69
+ | 名前 | 説明 |
70
+ | -------------------------------------| ----------------------------------------------------------|
71
+ | [ ` key_comp ` ] ( key_comp.md ) | キー比較用の関数オブジェクトを取得する |
72
+ | [ ` value_compare ` ] ( value_compare.md ) | 要素値のキー部分で大小関係を判定する二項述語の型 |
Original file line number Diff line number Diff line change
1
+ # value_compare
2
+ * flat_map[ meta header]
3
+ * std[ meta namespace]
4
+ * flat_map[ meta class]
5
+ * class[ meta id-type]
6
+ * cpp23[ meta cpp]
7
+
8
+ ``` cpp
9
+ namespace std {
10
+ class flat_map::value_compare;
11
+ }
12
+ ```
13
+
14
+ ## 概要
15
+ `value_compare` は `flat_map` の入れ子クラスで、`flat_map::value_type` 型のオブジェクトを比較する関数オブジェクト型である。
16
+ 比較の基準は `flat_map::key_compare` と同様であるが、`flat_map::key_compare` の関数呼び出し演算子の引数型が `flat_map::key_type` であるのに対して、本クラスの関数呼び出し演算子の比較型は `flat_map::value_type` である点が異なっている。
17
+ なお、引数のうち [`flat_map`](../../flat_map.md)`::mapped_type` にあたる [`pair`](../../utility/pair.md) の `second` 部については、比較時には無視される。
18
+
19
+
20
+ ## メンバ関数
21
+ | 名前 | 説明 | 対応バージョン |
22
+ |-----------------------------------------------------------|--------------------|----------------|
23
+ | [`operator()`](value_compare/op_call.md.nolink) | 関数呼び出し演算子 | |
24
+
25
+ 一般的な実装では、`key_compare` 型をメンバ変数で保持しており、その変数名を `comp` とすると、以下の動作となる。
26
+ ```cpp
27
+ bool operator()(const_reference x, const_reference y) const {
28
+ return comp(x.first, y.first);
29
+ }
30
+ ```
31
+
32
+
33
+ ## 例
34
+ [`value_comp()`](value_comp.md) の例を参照。
35
+
36
+
37
+ ## バージョン
38
+ ### 言語
39
+ - C++23
40
+
41
+ ### 処理系
42
+ - [Clang](/implementation.md#clang): ??
43
+ - [GCC](/implementation.md#gcc): ??
44
+ - [ICC](/implementation.md#icc): ??
45
+ - [Visual C++](/implementation.md#visual_cpp): ??
46
+
47
+
48
+ ## 関連項目
49
+
50
+ | 名前 | 説明 |
51
+ |-------------------------------------|----------------------------------------------------------|
52
+ | [`key_comp`](key_comp.md) | キー比較用の関数オブジェクトを取得する |
53
+ | [`value_comp`](value_comp.md) | 要素比較用の関数オブジェクトを返す |
You can’t perform that action at this time.
0 commit comments