File tree Expand file tree Collapse file tree 2 files changed +77
-2
lines changed Expand file tree Collapse file tree 2 files changed +77
-2
lines changed Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ namespace std {
75
75
| 名前 | 説明 | 対応バージョン |
76
76
|---------------------------------------|--------------------------------------------|-------|
77
77
| [`operator[]`](flat_map/op_at.md.nolink) | 指定したキーを持つ要素を取得する | C++23 |
78
- | [`at`](flat_map/at.md.nolink ) | 指定したキーを持つ要素を取得する | C++23 |
78
+ | [`at`](flat_map/at.md) | 指定したキーを持つ要素を取得する | C++23 |
79
79
| [`count`](flat_map/count.md.nolink) | 指定したキーにマッチする要素の数を取得する | C++23 |
80
80
| [`find`](flat_map/find.md.nolink) | 指定したキーで要素を探す | C++23 |
81
81
| [`contains`](flat_map/contains.md.nolink) | 指定したキーの要素が含まれているかを判定する | C++23 |
@@ -175,7 +175,7 @@ int main()
175
175
}
176
176
}
177
177
```
178
- * fm.at[ link flat_map/at.md.nolink ]
178
+ * fm.at[ link flat_map/at.md]
179
179
180
180
#### 出力
181
181
```
Original file line number Diff line number Diff line change
1
+ # at
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
+ mapped_type& at (const key_type& x); // (1) C++23
10
+ const mapped_type& at(const key_type& x) const; // (2) C++23
11
+ ```
12
+
13
+ ## 概要
14
+ 指定したキーを持つ要素を取得する。
15
+ 要素を取り出す際にキーの存在チェックをする。
16
+
17
+
18
+ ## 戻り値
19
+ キー`x`に対応する値を返す。対応する要素が存在しないときは、[`out_of_range`](/reference/stdexcept.md)例外を投げる。
20
+
21
+
22
+ ## 計算量
23
+ 要素数に対して対数時間
24
+
25
+
26
+ ## 例
27
+ ```cpp example
28
+ #include <iostream>
29
+ #include <flat_map>
30
+ #include <stdexcept>
31
+
32
+ namespace stdx = flat_map;
33
+ template<class Container, class T>
34
+ void at_wrap(Container& c, T v)
35
+ {
36
+ try {
37
+ std::cout << c.at(v) << std::endl;
38
+ }
39
+ catch(std::out_of_range&) {
40
+ std::cout << "exception std::out_of_range" << std::endl;
41
+ }
42
+ }
43
+
44
+ int main()
45
+ {
46
+ stdx::flat_map<int,char> fm;
47
+ fm.insert(std::make_pair(1, 'a'));
48
+
49
+ at_wrap(fm, 1);
50
+ at_wrap(fm, 2);
51
+ }
52
+ ```
53
+ * c.at[ color ff0000]
54
+ * fm.insert[ link insert.md.nolink]
55
+ * std::out_of_range[ link /reference/stdexcept.md]
56
+
57
+ ### 出力
58
+ ```
59
+ a
60
+ exception std::out_of_range
61
+ ```
62
+
63
+ ## バージョン
64
+ ### 言語
65
+ - C++23
66
+
67
+ ### 処理系
68
+ - [ Clang] ( /implementation.md#clang ) : ??
69
+ - [ GCC] ( /implementation.md#gcc ) : ??
70
+ - [ Visual C++] ( /implementation.md#visual_cpp ) : ??
71
+
72
+
73
+ ## 関連項目
74
+ - [ ` operator[] ` ] ( op_at.md.nolink )
75
+ - [ ` find() ` ] ( find.md.nolink )
You can’t perform that action at this time.
0 commit comments