File tree 21 files changed +406
-26
lines changed
expected/bad_expected_access
21 files changed +406
-26
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,8 @@ const auto d = hello("Adolph Blaine Charles David Earl Frederick Gerald Hubert I
54
54
- [`std::bad_array_new_length`](/reference/new/bad_array_new_length.md)
55
55
- [`std::bad_cast`](/reference/typeinfo/bad_cast.md)
56
56
- [`std::bad_typeid`](/reference/typeinfo/bad_typeid.md)
57
+ - [`<stdexcept>`](/reference/stdexcept.md)
58
+ - [`std::bad_expected_access`](/reference/expected/bad_expected_access.md)
57
59
58
60
59
61
## 参照
Original file line number Diff line number Diff line change 6
6
* cpp23[ meta cpp]
7
7
8
8
``` cpp
9
- constexpr const E& error () const & noexcept ; // (1)
10
- constexpr E& error () & noexcept ; // (2)
11
- constexpr const E&& error() const && noexcept ; // (3)
12
- constexpr E&& error() && noexcept ; // (4)
9
+ const E& error () const & noexcept ; // (1) C++23
10
+ constexpr const E& error () const & noexcept ; // (1) C++26
11
+
12
+ E& error () & noexcept ; // (2) C++23
13
+ constexpr E& error () & noexcept ; // (2) C++26
14
+
15
+ const E&& error() const && noexcept ; // (3) C++23
16
+ constexpr const E&& error() const && noexcept ; // (3) C++26
17
+
18
+ E&& error() && noexcept ; // (4) C++23
19
+ constexpr E&& error() && noexcept ; // (4) C++26
13
20
```
14
21
15
22
## 概要
@@ -66,6 +73,12 @@ throw:ERR
66
73
- [ Visual C++] ( /implementation.md#visual_cpp ) : ??
67
74
68
75
76
+ ## 関連項目
77
+ - [ C++26 定数評価での例外送出を許可] ( /lang/cpp26/allowing_exception_throwing_in_constant-evaluation.md )
78
+
79
+
69
80
## 参照
70
81
- [ P0323R12 std::expected] ( https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p0323r12.html )
71
82
- [ P2549R1 ` std::unexpected<E> ` should have ` error() ` as member accessor] ( https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2549r1.html )
83
+ - [ P3378R2 ` constexpr ` exception types] ( https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3378r2.html )
84
+ - C++26で` constexpr ` 対応した
Original file line number Diff line number Diff line change 6
6
* cpp23[ meta cpp]
7
7
8
8
``` cpp
9
- explicit bad_expected_access (E e); // (1)
10
- bad_expected_access(const bad_expected_access&); // (2)
11
- bad_expected_access(bad_expected_access&&); // (3)
9
+ explicit bad_expected_access (E e); // (1) C++23
10
+ constexpr explicit bad_expected_access(E e); // (1) C++26
11
+
12
+ bad_expected_access(const bad_expected_access&); // (2) C++23
13
+ constexpr bad_expected_access(const bad_expected_access&); // (2) C++26
14
+
15
+ bad_expected_access(bad_expected_access&&); // (3) C++23
16
+ constexpr bad_expected_access(bad_expected_access&&); // (3) C++26
12
17
```
13
18
* bad_expected_access[link ../bad_expected_access.md]
14
19
@@ -48,5 +53,11 @@ int main()
48
53
- [ Visual C++] ( /implementation.md#visual_cpp ) : ??
49
54
50
55
56
+ ## 関連項目
57
+ - [ C++26 定数評価での例外送出を許可] ( /lang/cpp26/allowing_exception_throwing_in_constant-evaluation.md )
58
+
59
+
51
60
## 参照
52
61
- [ P0323R12 std::expected] ( https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p0323r12.html )
62
+ - [ P3378R2 ` constexpr ` exception types] ( https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3378r2.html )
63
+ - C++26で` constexpr ` 対応した
Original file line number Diff line number Diff line change 6
6
* cpp23[ meta cpp]
7
7
8
8
``` cpp
9
- const char * what () const noexcept override ;
9
+ const char * what () const noexcept override ; // (1) C++23
10
+ constexpr const char * what () const noexcept override ; // (1) C++26
10
11
```
11
12
12
13
## 概要
@@ -60,5 +61,11 @@ bad access to std::expected without expected value
60
61
- [ Visual C++] ( /implementation.md#visual_cpp ) : ??
61
62
62
63
64
+ ## 関連項目
65
+ - [ C++26 定数評価での例外送出を許可] ( /lang/cpp26/allowing_exception_throwing_in_constant-evaluation.md )
66
+
67
+
63
68
## 参照
64
69
- [ P0323R12 std::expected] ( https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p0323r12.html )
70
+ - [ P3378R2 ` constexpr ` exception types] ( https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3378r2.html )
71
+ - C++26で` constexpr ` 対応した
Original file line number Diff line number Diff line change 6
6
7
7
``` cpp
8
8
namespace std {
9
- class format_error : public runtime_error {
10
- public:
11
- explicit format_error(const string& what_arg);
12
- explicit format_error(const char* what_arg);
13
- };
9
+ class format_error : public runtime_error;
14
10
}
15
11
```
16
- * string[link /reference/string/basic_string.md]
17
12
18
13
## 概要
19
14
`<format>`の各機能の失敗を表す例外クラス。ユーザー定義フォーマッターもこの例外を投げることができる。
20
15
21
16
## メンバ関数
22
17
### 構築・破棄
23
18
24
- | 名前 | 説明 | 対応バージョン |
25
- |-----------------|----------------|----------------|
26
- | `(constructor)` | コンストラクタ | C++20 |
19
+ | 名前 | 説明 | 対応バージョン |
20
+ |------|------|----------------|
21
+ | [(constructor)](format_error/op_constructor.md) | コンストラクタ | C++20 |
22
+ | [(destructor)](format_error/op_destructor.md) | デストラクタ | C++20 |
23
+ | [`operator=`](format_error/op_assign.md) | 代入演算子 | C++20 |
24
+ | [`what`](format_error/what.md) | エラー理由を取得する | C++20 |
25
+
27
26
28
27
## バージョン
29
28
### 言語
Original file line number Diff line number Diff line change
1
+ # operator=
2
+ * format[ meta header]
3
+ * std[ meta namespace]
4
+ * format_error[ meta class]
5
+ * function[ meta id-type]
6
+ * cpp20[ meta cpp]
7
+
8
+ ``` cpp
9
+ format_error& operator =(const format_error&) noexcept ; // (1) C++20
10
+ constexpr format_error& operator =(const format_error&) noexcept ; // (1) C++26
11
+ ```
12
+
13
+ ## 概要
14
+ ` format_error ` オブジェクトを代入する
15
+
16
+ - (1) : コピー代入
17
+
18
+
19
+ ## 例外
20
+ 投げない
21
+
22
+
23
+ ## 関連項目
24
+ - [ C++26 定数評価での例外送出を許可] ( /lang/cpp26/allowing_exception_throwing_in_constant-evaluation.md )
25
+
26
+
27
+ ## 参照
28
+ - [ P3378R2 ` constexpr ` exception types] ( https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3378r2.html )
29
+ - C++26で` constexpr ` 対応した
Original file line number Diff line number Diff line change
1
+ # コンストラクタ
2
+ * format[ meta header]
3
+ * std[ meta namespace]
4
+ * format_error[ meta class]
5
+ * function[ meta id-type]
6
+ * cpp20[ meta cpp]
7
+
8
+ ``` cpp
9
+ explicit format_error (const string& what_arg); // (1) C++20
10
+ constexpr explicit format_error(const string& what_arg); // (1) C++26
11
+
12
+ explicit format_error(const char* what_arg); // (2) C++20
13
+ constexpr explicit format_error(const char* what_arg); // (2) C++26
14
+ ```
15
+
16
+ ## 概要
17
+ `format_error`オブジェクトを構築する。
18
+
19
+ - (1) : `std::string`オブジェクトでエラー理由を受け取る
20
+ - (2) : `const char*`でエラー理由を受け取る
21
+
22
+
23
+ ## 事後条件
24
+
25
+ - (1) : `strcmp(what(), what_arg.c_str()) == 0`
26
+ - (2) : `strcmp(what(), what_arg) == 0`
27
+
28
+
29
+ ## 関連項目
30
+ - [C++26 定数評価での例外送出を許可](/lang/cpp26/allowing_exception_throwing_in_constant-evaluation.md)
31
+
32
+
33
+ ## 参照
34
+ - [P3378R2 `constexpr` exception types](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3378r2.html)
35
+ - C++26で`constexpr`対応した
Original file line number Diff line number Diff line change
1
+ # デストラクタ
2
+ * format[ meta header]
3
+ * std[ meta namespace]
4
+ * format_error[ meta class]
5
+ * function[ meta id-type]
6
+ * cpp20[ meta cpp]
7
+
8
+ ``` cpp
9
+ virtual ~format_error (); // (1) C++20
10
+ constexpr virtual ~format_error (); // (1) C++26
11
+ ```
12
+
13
+ ## 概要
14
+ ` format_error ` オブジェクトを破棄する。
15
+
16
+
17
+ ## 例外
18
+ 投げない
19
+
20
+
21
+ ## 関連項目
22
+ - [ C++26 定数評価での例外送出を許可] ( /lang/cpp26/allowing_exception_throwing_in_constant-evaluation.md )
23
+
Original file line number Diff line number Diff line change
1
+ # what
2
+ * format[ meta header]
3
+ * std[ meta namespace]
4
+ * format_error[ meta class]
5
+ * function[ meta id-type]
6
+ * cpp20[ meta cpp]
7
+
8
+ ``` cpp
9
+ const char * what () const noexcept override ; // (1) C++20
10
+ constexpr const char * what () const noexcept override ; // (1) C++26
11
+ ```
12
+
13
+ ## 概要
14
+ エラー理由となる実装依存文字列を取得する。
15
+
16
+
17
+ ## 例外
18
+ 投げない
19
+
20
+
21
+ ## 関連項目
22
+ - [ C++26 定数評価での例外送出を許可] ( /lang/cpp26/allowing_exception_throwing_in_constant-evaluation.md )
23
+
24
+
25
+ ## 参照
26
+ - [ P3378R2 ` constexpr ` exception types] ( https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3378r2.html )
27
+ - C++26で` constexpr ` 対応した
Original file line number Diff line number Diff line change 6
6
* cpp11[ meta cpp]
7
7
8
8
``` cpp
9
- virtual ~bad_array_new_length (); // (1) C++03
9
+ virtual ~bad_array_new_length (); // (1) C++11
10
10
constexpr virtual ~bad_array_new_length (); // (1) C++26
11
11
```
12
12
Original file line number Diff line number Diff line change @@ -19,8 +19,10 @@ namespace std {
19
19
20
20
| 名前 | 説明 | 対応バージョン |
21
21
|------|------|----------------|
22
- | `bad_optional_access();` | デフォルトコンストラクタ | C++17 |
23
- | `virtual const char* what() const noexcept;` | エラー理由となる実装依存文字列 | C++17 |
22
+ | [(constructor)](bad_optional_access/op_constructor.md) | コンストラクタ | C++17 |
23
+ | [(destructor)](bad_optional_access/op_destructor.md) | デストラクタ | C++17 |
24
+ | [`operator=`](bad_optional_access/op_assign.md) | 代入演算子 | C++17 |
25
+ | [`what`](bad_optional_access/what.md) | エラー理由を取得する | C++17 |
24
26
25
27
26
28
## 例
Original file line number Diff line number Diff line change
1
+ # operator=
2
+ * optional[ meta header]
3
+ * std[ meta namespace]
4
+ * bad_optional_access[ meta class]
5
+ * function[ meta id-type]
6
+ * cpp17[ meta cpp]
7
+
8
+ ``` cpp
9
+ bad_optional_access& operator =(const bad_optional_access&) noexcept ; // (1) C++17
10
+ constexpr bad_optional_access& operator =(const bad_optional_access&) noexcept ; // (1) C++26
11
+ ```
12
+
13
+ ## 概要
14
+ ` bad_optional_access ` オブジェクトを代入する
15
+
16
+ - (1) : コピー代入
17
+
18
+
19
+ ## 例外
20
+ 投げない
21
+
22
+
23
+ ## 関連項目
24
+ - [ C++26 定数評価での例外送出を許可] ( /lang/cpp26/allowing_exception_throwing_in_constant-evaluation.md )
25
+
26
+
27
+ ## 参照
28
+ - [ P3378R2 ` constexpr ` exception types] ( https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3378r2.html )
29
+ - C++26で` constexpr ` 対応した
Original file line number Diff line number Diff line change
1
+ # コンストラクタ
2
+ * optional[ meta header]
3
+ * std[ meta namespace]
4
+ * bad_optional_access[ meta class]
5
+ * function[ meta id-type]
6
+ * cpp17[ meta cpp]
7
+
8
+ ``` cpp
9
+ bad_optional_access () noexcept ; // (1) C++17
10
+ constexpr bad_optional_access () noexcept ; // (1) C++26
11
+
12
+ bad_optional_access (const bad_optional_access&) noexcept; // (2) C++17
13
+ constexpr bad_optional_access(const bad_optional_access&) noexcept; // (2) C++26
14
+ ```
15
+
16
+ ## 概要
17
+ `bad_optional_access`オブジェクトを構築する。
18
+
19
+ - (1) : デフォルトコンストラクタ
20
+ - (2) : コピーコンストラクタ
21
+
22
+
23
+ ## 例外
24
+ 投げない
25
+
26
+
27
+ ## 関連項目
28
+ - [C++26 定数評価での例外送出を許可](/lang/cpp26/allowing_exception_throwing_in_constant-evaluation.md)
29
+
30
+
31
+ ## 参照
32
+ - [P3378R2 `constexpr` exception types](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3378r2.html)
33
+ - C++26で`constexpr`対応した
Original file line number Diff line number Diff line change
1
+ # デストラクタ
2
+ * optional[ meta header]
3
+ * std[ meta namespace]
4
+ * bad_optional_access[ meta class]
5
+ * function[ meta id-type]
6
+ * cpp17[ meta cpp]
7
+
8
+ ``` cpp
9
+ virtual ~bad_optional_access (); // (1) C++17
10
+ constexpr virtual ~bad_optional_access (); // (1) C++26
11
+ ```
12
+
13
+ ## 概要
14
+ ` bad_array_new_length ` オブジェクトを破棄する。
15
+
16
+
17
+ ## 例外
18
+ 投げない
19
+
20
+
21
+ ## 関連項目
22
+ - [ C++26 定数評価での例外送出を許可] ( /lang/cpp26/allowing_exception_throwing_in_constant-evaluation.md )
23
+
Original file line number Diff line number Diff line change
1
+ # what
2
+ * optional[ meta header]
3
+ * std[ meta namespace]
4
+ * bad_optional_access[ meta class]
5
+ * function[ meta id-type]
6
+ * cpp17[ meta cpp]
7
+
8
+ ``` cpp
9
+ const char * what () const noexcept override ; // (1) C++17
10
+ constexpr const char * what () const noexcept override ; // (1) C++26
11
+ ```
12
+
13
+ ## 概要
14
+ エラー理由となる実装依存文字列を取得する。
15
+
16
+
17
+ ## 例外
18
+ 投げない
19
+
20
+
21
+ ## 関連項目
22
+ - [ C++26 定数評価での例外送出を許可] ( /lang/cpp26/allowing_exception_throwing_in_constant-evaluation.md )
23
+
24
+
25
+ ## 参照
26
+ - [ P3378R2 ` constexpr ` exception types] ( https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3378r2.html )
27
+ - C++26で` constexpr ` 対応した
You can’t perform that action at this time.
0 commit comments