File tree Expand file tree Collapse file tree 2 files changed +42
-1
lines changed Expand file tree Collapse file tree 2 files changed +42
-1
lines changed Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ C++17では以下のTSが採用された:
87
87
88
88
| 言語機能 | 説明 |
89
89
| ----------| ------|
90
- | 例外仕様を型システムの一部にする | 関数の型に例外仕様が含まれるようにする |
90
+ | [ 例外仕様を型システムの一部にする] ( cpp17/exception_spec_be_part_of_the_type_system.md.nolink ) | 関数の型に例外仕様が含まれるようにする |
91
91
| 非推奨だった古い例外仕様を削除 | ` throw ` キーワードによる例外仕様を削除。` throw() ` は残る |
92
92
93
93
@@ -128,6 +128,7 @@ C++17では以下のTSが採用された:
128
128
| 言語機能 | 説明 |
129
129
| ----------| ------|
130
130
| [ 更新された定義済みマクロ] ( cpp17/predefined_macros.md ) | 標準規格で定義されたマクロの更新 |
131
+ | [ ` noexcept ` 付きのラムダ式から変換する関数ポインタに` noexcept ` を付加する] ( cpp17/lambda_to_noexcept_function_pointer.md ) | キャプチャを持たない非ジェネリックラムダに` noexcept ` を付加した場合、変換した関数ポインタに` noexcept ` を付加する |
131
132
132
133
133
134
## ライブラリ更新の概要
Original file line number Diff line number Diff line change
1
+ # noexcept付きのラムダ式から変換する関数ポインタにnoexceptを付加する
2
+ * cpp17[ meta cpp]
3
+
4
+ ## 概要
5
+ キャプチャを持たない非ジェネリックなラムダ式は、関数ポインタに変換できる。そのラムダ式が例外を投げない指定をされていた場合、変換された関数ポインタもまた` noexcept ` を持つ。
6
+
7
+ 例外を投げない指定とは、以下のいずれかである:
8
+
9
+ - ` noexcept `
10
+ - ` noexcept(true) `
11
+ - ` throw() ` (C++17から非推奨)
12
+
13
+
14
+ ## 例
15
+ ``` cpp
16
+ #include < iostream>
17
+
18
+ int main ()
19
+ {
20
+ int (* fp)() noexcept = [ ] ( ) noexcept { return 1; };
21
+
22
+ std::cout << fp() << std::endl;
23
+ }
24
+ ```
25
+
26
+ ### 出力
27
+ ```
28
+ 1
29
+ ```
30
+
31
+
32
+ ## 関連項目
33
+ - [ C++17 例外仕様を型システムの一部にする] ( exception_spec_be_part_of_the_type_system.md.nolink )
34
+ - [ C++11 ラムダ式] ( /lang/cpp11/lambda_expressions.md )
35
+ - [ C++14 ジェネリックラムダ] ( /lang/cpp14/generic_lambdas.md )
36
+
37
+
38
+ ## 参照
39
+ - [ CWG Issue 1722. Should lambda to function pointer conversion function be ` noexcept ` ?] ( https://wg21.cmeerw.net/cwg/issue1722 )
40
+
You can’t perform that action at this time.
0 commit comments