Skip to content

Commit 4fd9557

Browse files
committed
flat_map : add keys() and values() (#1078)
1 parent 1854555 commit 4fd9557

File tree

3 files changed

+138
-2
lines changed

3 files changed

+138
-2
lines changed

reference/flat_map/flat_map.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ namespace std {
8989
|-------------------------------------|----------------------------------------|----------------|
9090
| [`key_comp`](flat_map/key_comp.md) | キー比較用の関数オブジェクトを取得する | C++23 |
9191
| [`value_comp`](flat_map/value_comp.md) | 要素比較用の関数オブジェクトを取得する | C++23 |
92-
| [`keys`](flat_map/keys.md.nolink) | キーのコンテナを取得する | C++23 |
93-
| [`values`](flat_map/values.md.nolink) | 値のコンテナを取得する | C++23 |
92+
| [`keys`](flat_map/keys.md) | キーのコンテナを取得する | C++23 |
93+
| [`values`](flat_map/values.md) | 値のコンテナを取得する | C++23 |
9494
9595
9696
## メンバ型
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# keys
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+
const key_container_type& keys() const noexcept; // C++23
10+
```
11+
12+
## 概要
13+
キーのコンテナを取得する。
14+
15+
16+
## 戻り値
17+
`flat_map` クラス内部で保持しているキーのコンテナ。
18+
19+
20+
## 計算量
21+
定数時間
22+
23+
24+
##
25+
```cpp example
26+
#include <flat_map>
27+
#include <iostream>
28+
#include <type_traits>
29+
#include <vector>
30+
31+
int main()
32+
{
33+
std::flat_map<int, char> fm;
34+
fm[3] = 'C';
35+
fm[1] = 'A';
36+
fm[2] = 'B';
37+
38+
static_assert(std::is_same_v<decltype(fm.keys()), const std::vector<int>&>);
39+
40+
for (auto i : fm.keys()) {
41+
std::cout << i << std::endl;
42+
}
43+
}
44+
```
45+
* keys()[color ff0000]
46+
47+
### 出力
48+
```
49+
1
50+
2
51+
3
52+
```
53+
54+
## バージョン
55+
### 言語
56+
- C++23
57+
58+
### 処理系
59+
- [Clang](/implementation.md#clang): ??
60+
- [GCC](/implementation.md#gcc): ??
61+
- [Visual C++](/implementation.md#visual_cpp): ??
62+
63+
64+
## 関連項目
65+
66+
| 名前 | 説明 |
67+
|-----------------------------------|-------------------------------------------|
68+
| [`flat_map::values`](values.md) | 値のコンテナを取得する |
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# values
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+
const mapped_container_type& values() const noexcept; // C++23
10+
```
11+
12+
## 概要
13+
値のコンテナを取得する。
14+
15+
16+
## 戻り値
17+
`flat_map` クラス内部で保持している値のコンテナ。
18+
19+
20+
## 計算量
21+
定数時間
22+
23+
24+
##
25+
```cpp example
26+
#include <flat_map>
27+
#include <iostream>
28+
#include <type_traits>
29+
#include <vector>
30+
31+
int main()
32+
{
33+
std::flat_map<int, char> fm;
34+
fm[3] = 'C';
35+
fm[1] = 'A';
36+
fm[2] = 'B';
37+
38+
static_assert(std::is_same_v<decltype(fm.values()), const std::vector<char>&>);
39+
40+
for (auto i : fm.values()) {
41+
std::cout << i << std::endl;
42+
}
43+
}
44+
```
45+
* values()[color ff0000]
46+
47+
### 出力
48+
```
49+
A
50+
B
51+
C
52+
```
53+
54+
## バージョン
55+
### 言語
56+
- C++23
57+
58+
### 処理系
59+
- [Clang](/implementation.md#clang): ??
60+
- [GCC](/implementation.md#gcc): ??
61+
- [Visual C++](/implementation.md#visual_cpp): ??
62+
63+
64+
## 関連項目
65+
66+
| 名前 | 説明 |
67+
|-------------------------------|-------------------------------------------|
68+
| [`flat_map::keys`](keys.md) | キーのコンテナを取得する |

0 commit comments

Comments
 (0)