diff --git a/lang/cpp26/feature_test_macros.md b/lang/cpp26/feature_test_macros.md index 6f52f77200..058935702c 100755 --- a/lang/cpp26/feature_test_macros.md +++ b/lang/cpp26/feature_test_macros.md @@ -193,6 +193,8 @@ ## 参照 - [SD-FeatureTest: Feature-Test Macros and Policies - isocpp](https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations) +- [LWG Issue 4286. Some more feature-test macros for fully freestanding features are not marked freestanding](https://cplusplus.github.io/LWG/issue4286) + - C++26で、`__cpp_lib_aligned_accessor`・`__cpp_lib_array_constexpr`・`__cpp_lib_clamp`・`__cpp_lib_constexpr_numeric`・`__cpp_lib_function_ref`・`__cpp_lib_gcd_lcm`・`__cpp_lib_integer_comparison_functions`・`__cpp_lib_is_sufficiently_aligned`・`__cpp_lib_ranges_contains`・`__cpp_lib_ranges_enumerate`・`__cpp_lib_ranges_find_last`・`__cpp_lib_ranges_fold`・`__cpp_lib_ranges_iota`・`__cpp_lib_ranges_starts_ends_with`・`__cpp_lib_robust_nonmodifying_seq_ops`・`__cpp_lib_sample`・`__cpp_lib_saturation_arithmetic`が、フリースタンディング機能に対応するマクロとしてマークされた(あわせて``の`is_sufficiently_aligned`もフリースタンディング指定された) - [LWG Issue 4550. Need new feature test macros for `` and ``](https://cplusplus.github.io/LWG/issue4550) - C++26で、`__cpp_lib_stdbit_h`と`__cpp_lib_stdckdint_h`が追加された - [P3371R5 Fix C++26 BLAS rank updates consistency](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3371r5.html) diff --git a/reference/algorithm/ranges_partition.md b/reference/algorithm/ranges_partition.md index a87c9e0d11..5093e3f848 100644 --- a/reference/algorithm/ranges_partition.md +++ b/reference/algorithm/ranges_partition.md @@ -172,3 +172,5 @@ odd: 5 3 7 1 ## 参照 - [N4861 25 Algorithms library](https://timsong-cpp.github.io/cppwp/n4861/algorithms) - [P3179R9 C++ parallel range algorithms](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3179r9.html) +- [LWG Issue 4297. Missing `permutable` constraint for iterator overloads in Parallel Range Algorithms](https://cplusplus.github.io/LWG/issue4297) + - C++26で、並列版のイテレータオーバーロード(3)に`permutable`制約が追加された(範囲版(4)にはあったが、イテレータ版で欠落していたものの修正) diff --git a/reference/algorithm/ranges_remove.md b/reference/algorithm/ranges_remove.md index 0ce717b591..d55c2af512 100644 --- a/reference/algorithm/ranges_remove.md +++ b/reference/algorithm/ranges_remove.md @@ -255,3 +255,5 @@ int main() { - [P2248R8 Enabling list-initialization for algorithms](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2248r8.html) - C++26で波カッコ初期化 (リスト初期化) に対応した - [P3179R9 C++ parallel range algorithms](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3179r9.html) +- [LWG Issue 4297. Missing `permutable` constraint for iterator overloads in Parallel Range Algorithms](https://cplusplus.github.io/LWG/issue4297) + - C++26で、並列版のイテレータオーバーロード(3)に`permutable`制約が追加された(範囲版(4)にはあったが、イテレータ版で欠落していたものの修正) diff --git a/reference/algorithm/ranges_remove_if.md b/reference/algorithm/ranges_remove_if.md index b6c23a265f..1d4a3b064b 100644 --- a/reference/algorithm/ranges_remove_if.md +++ b/reference/algorithm/ranges_remove_if.md @@ -171,3 +171,5 @@ int main() { ## 参照 - [N4861 25 Algorithms library](https://timsong-cpp.github.io/cppwp/n4861/algorithms) - [P3179R9 C++ parallel range algorithms](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3179r9.html) +- [LWG Issue 4297. Missing `permutable` constraint for iterator overloads in Parallel Range Algorithms](https://cplusplus.github.io/LWG/issue4297) + - C++26で、並列版のイテレータオーバーロード(3)に`permutable`制約が追加された(範囲版(4)にはあったが、イテレータ版で欠落していたものの修正) diff --git a/reference/algorithm/ranges_unique_copy.md b/reference/algorithm/ranges_unique_copy.md index a7e1bf61d0..701550fb7c 100644 --- a/reference/algorithm/ranges_unique_copy.md +++ b/reference/algorithm/ranges_unique_copy.md @@ -208,3 +208,5 @@ int main() { ## 参照 - [N4861 25 Algorithms library](https://timsong-cpp.github.io/cppwp/n4861/algorithms) - [P3179R9 C++ parallel range algorithms](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3179r9.html) +- [LWG Issue 4269. `unique_copy` passes arguments to its predicate backwards](https://cplusplus.github.io/LWG/issue4269) + - C++26で、比較`comp`に渡す引数の順序が`comp(invoke(proj, *i), invoke(proj, *(i - 1)))`から`comp(invoke(proj, *(i - 1)), invoke(proj, *i))`へ修正された(記述上の引数順の誤りの修正。`comp`は同値関係であることが要求されるため動作は変わらない) diff --git a/reference/algorithm/unique_copy.md b/reference/algorithm/unique_copy.md index 8a621dfdd3..79e5602c3d 100644 --- a/reference/algorithm/unique_copy.md +++ b/reference/algorithm/unique_copy.md @@ -183,3 +183,5 @@ OutputIterator unique_copy(InputIterator first, InputIterator last, ## 参照 - [P0202R3 Add Constexpr Modifiers to Functions in `` and `` Headers](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0202r3.html) - [P0467R2 Iterator Concerns for Parallel Algorithms](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0467r2.html) +- [LWG Issue 4269. `unique_copy` passes arguments to its predicate backwards](https://cplusplus.github.io/LWG/issue4269) + - C++26で、述語`pred`に渡す引数の順序が`pred(*i, *(i - 1))`から`pred(*(i - 1), *i)`へ修正された(記述上の引数順の誤りの修正。`pred`は同値関係であることが要求されるため動作は変わらない) diff --git a/reference/array.md b/reference/array.md index b2f236a9c4..13861d1363 100644 --- a/reference/array.md +++ b/reference/array.md @@ -12,6 +12,9 @@ - [``](compare.md) (C++20) +## フリースタンディング +このヘッダのほとんどの機能は、フリースタンディング処理系でも使用できる。ただし、例外を送出する一部の機能などは、フリースタンディング処理系では提供されない、または削除される。詳細は各機能のページを参照。 + | 名前 | 説明 | 対応バージョン | |-----------------------------|----------------------------|-------| | [`array`](array/array.md) | 固定長配列(class template) | C++11 | diff --git a/reference/array/array/at.md b/reference/array/array/at.md index 79aabf3bd4..9f41d3470b 100644 --- a/reference/array/array/at.md +++ b/reference/array/array/at.md @@ -30,6 +30,8 @@ n番目の要素を参照する。 ## 備考 +この関数は、例外を送出しうるため、フリースタンディング処理系では削除される(フリースタンディング処理系では使用できない)。 + `a.at(n)` は `*(a.`[`begin()`](begin.md) `+ n)` と同じ結果になる。 diff --git a/reference/array/array/back.md b/reference/array/array/back.md index 270e01cf27..669181bfc1 100644 --- a/reference/array/array/back.md +++ b/reference/array/array/back.md @@ -17,11 +17,18 @@ constexpr const_reference back() const; // (2) C++14 最後尾要素を参照する。 +## 堅牢化された事前条件 +- C++26 : `a.`[`empty()`](empty.md)が`false`であること(要素数`N`が`0`でないこと) + + ## 戻り値 `a.back()`は末尾の要素への参照を返す。もし、`a`が`const`だった場合には、末尾の要素への`const`参照を返す。`a.back()` は`{ auto tmp = a.end(); --tmp; return *tmp; }` と同じ結果になる。 ## 備考 -要素数が0の場合(`N == 0`の場合)、動作は未定義である。 +要素数が0の場合(`N == 0`の場合)、この関数を呼び出してはならない。 + +- C++11 : 長さ0の配列に対して呼び出したときの動作は未定義 +- C++26 : 上記の特別な規定は削除され、他の要素アクセス関数と同様に、堅牢化された事前条件の違反として扱われる ## 例 @@ -65,3 +72,5 @@ int main() ## 参照 - [N3470 Constexpr Library Additions: containers, v2](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3470.html) - [P0031R0 A Proposal to Add Constexpr Modifiers to `reverse_iterator`, `move_iterator`, `array` and Range Access](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0031r0.html) +- [LWG Issue 4276. `front()` and `back()` are not hardened for zero-length `std::array`](https://cplusplus.github.io/LWG/issue4276) + - C++26で、[array.zero]の「長さ0の配列で`front()`/`back()`を呼び出したときの動作は未定義」という特別規定が削除され、他の要素アクセス関数と同様に堅牢化された事前条件の対象となった diff --git a/reference/array/array/front.md b/reference/array/array/front.md index 6cc0b68834..6d5930afa6 100644 --- a/reference/array/array/front.md +++ b/reference/array/array/front.md @@ -17,13 +17,21 @@ constexpr const_reference front() const; // (2) C++14 先頭要素を参照する。 +## 堅牢化された事前条件 +- C++26 : `a.`[`empty()`](empty.md)が`false`であること(要素数`N`が`0`でないこと) + + ## 戻り値 `a.front()`は先頭の要素への参照を返す。もし、`a`が`const`だった場合には、先頭の要素への`const`参照を返す。 ## 備考 `a.front()` と `*a.begin()` は同じ結果になる。 -要素数が0の場合(`N == 0`の場合)、動作は未定義である。 + +要素数が0の場合(`N == 0`の場合)、この関数を呼び出してはならない。 + +- C++11 : 長さ0の配列に対して呼び出したときの動作は未定義 +- C++26 : 上記の特別な規定は削除され、他の要素アクセス関数と同様に、堅牢化された事前条件の違反として扱われる ## 例 @@ -68,3 +76,5 @@ int main() ## 参照 - [N3470 Constexpr Library Additions: containers, v2](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3470.html) - [P0031R0 A Proposal to Add Constexpr Modifiers to `reverse_iterator`, `move_iterator`, `array` and Range Access](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0031r0.html) +- [LWG Issue 4276. `front()` and `back()` are not hardened for zero-length `std::array`](https://cplusplus.github.io/LWG/issue4276) + - C++26で、[array.zero]の「長さ0の配列で`front()`/`back()`を呼び出したときの動作は未定義」という特別規定が削除され、他の要素アクセス関数と同様に堅牢化された事前条件の対象となった diff --git a/reference/atomic.md b/reference/atomic.md index 140f3e5618..b9dbc8bb6e 100644 --- a/reference/atomic.md +++ b/reference/atomic.md @@ -7,7 +7,8 @@ アトミック操作は、スレッド間でデータをやり取りするための最も基本的な同期プリミティブであり、 変数への不可分(atomic)な読み込みや書き込み、および読み書きを同時に行う操作(Read-Modify-Write operation)を提供する。 -本ヘッダはフリースタンディング環境でも提供される。 +## フリースタンディング +このヘッダのほとんどの機能は、フリースタンディング処理系でも使用できる。ただし、例外を送出する一部の機能などは、フリースタンディング処理系では提供されない、または削除される。詳細は各機能のページを参照。 フリースタンディング環境の場合、常にロックフリーな整数アトミック型のサポート、`atomic_signed_lock_free`や`atomic_unsigned_lock_free`の提供可否は処理系定義となる。 ## 順序と一貫性 diff --git a/reference/atomic/atomic_ref.md b/reference/atomic/atomic_ref.md index affc162317..c3d200e6b2 100644 --- a/reference/atomic/atomic_ref.md +++ b/reference/atomic/atomic_ref.md @@ -79,7 +79,7 @@ C++26から、これらの特殊化はCV修飾された型に対しても行わ `is_always_lock_free == true`の場合、このクラスのオブジェクトをシグナルハンドラー内で使用できる。 -`required_alignment`について、ハードウェアは参照するオブジェクトに対して、型`T`のほかのオブジェクトよりも厳密なアライメントを持つことを要求できる。また、`atomic_ref`がロックフリーかどうかは、参照するオブジェクトのアライメントに依存する。たとえば[`std::complex`](/reference/complex/complex.md)``のロックフリー操作は`2 * alignof(double)`にアライメントされる場合にのみサポートされる。 +実装は、`atomic_ref`の全てのオブジェクトに対する操作がロックフリーとなることを保証するために、`required_alignment`を`alignof(T)`より大きな値として定義することを選択できる。 C++26では、`T`にCV修飾を加えた任意の型`U`について、`required_alignment`と`is_always_lock_free`の値は`atomic_ref<`[`remove_cv_t`](/reference/type_traits/remove_cv.md)`>`のものと同じである。これにより、CV修飾の違いによってアライメント要求やロックフリー保証が変わらないことが保証される。 @@ -238,5 +238,7 @@ int main() - C++26でCV修飾されたテンプレート引数を受け取れるようになった - [LWG Issue 4453. `atomic_ref::required_alignment` should be the same as for `T`](https://cplusplus.github.io/LWG/issue4453) - C++26で、CV修飾の違いによって`required_alignment`と`is_always_lock_free`の値が変わらないことが保証された +- [LWG Issue 4377. Misleading note about lock-free property of `std::atomic_ref`](https://cplusplus.github.io/LWG/issue4377) + - C++26で、`required_alignment`に関する誤解を招く注記(`complex`の例など)が、「実装はすべての操作がロックフリーとなるよう`required_alignment`を`alignof(T)`より大きく定義できる」という趣旨の注記へ修正された - [LWG Issue 4450. `std::atomic_ref::store` should be disabled for const `T`](https://cplusplus.github.io/LWG/issue4450) - C++26で、`T`が`const`修飾されている場合に`store`をはじめとする値を変更するメンバ関数が制約により無効化されることが規定された diff --git a/reference/bit.md b/reference/bit.md index dc01b525d1..9a767dd865 100644 --- a/reference/bit.md +++ b/reference/bit.md @@ -4,7 +4,8 @@ ``ヘッダでは、ビット操作のための機能を定義する。 -本ヘッダはフリースタンディング環境でも提供される。 +## フリースタンディング +このヘッダは、フリースタンディング処理系でも使用できる。本ヘッダが提供する全ての機能がフリースタンディング処理系で使用可能である。 ## 変換 diff --git a/reference/bitset/bitset/op_constructor.md b/reference/bitset/bitset/op_constructor.md index d17aea26c7..0bce40e1ac 100644 --- a/reference/bitset/bitset/op_constructor.md +++ b/reference/bitset/bitset/op_constructor.md @@ -72,6 +72,11 @@ constexpr explicit bitset( - (5) : `'0'`と`'1'`の文字で構成される文字配列からビット列を構築する +## テンプレートパラメータ制約 +- (5) : + - C++26 : [`is_array_v`](/reference/type_traits/is_array.md)``が`false`、[`is_trivially_copyable_v`](/reference/type_traits/is_trivially_copyable.md)``が`true`、[`is_standard_layout_v`](/reference/type_traits/is_standard_layout.md)``が`true`、かつ[`is_trivially_default_constructible_v`](/reference/type_traits/is_trivially_default_constructible.md)``が`true`であること + + ## 要件 - (3), (4) : `pos <= str.`[`size()`](/reference/string/basic_string/size.md) @@ -165,3 +170,5 @@ int main() - [P2417R2 A more constexpr bitset](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2417r2.pdf) - [P2697R1 Interfacing `bitset` with `string_view`](https://open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2697r1.pdf) - C++26から`string_view`を受け取るコンストラクタが追加された +- [LWG Issue 4294. `bitset(const CharT*)` constructor needs to be constrained](https://cplusplus.github.io/LWG/issue4294) + - C++26で、(5)の`const CharT*`をとるコンストラクタに、`CharT`が文字型に相当することを表すテンプレートパラメータ制約(`is_array_v`が`false`、`is_trivially_copyable_v`/`is_standard_layout_v`/`is_trivially_default_constructible_v`が`true`)が追加された。`CharT`が推論されるために不適当な型でもオーバーロード解決に参加してしまう問題を防ぐもの diff --git a/reference/cerrno.md b/reference/cerrno.md index 3ac8100c20..9fa48490f4 100644 --- a/reference/cerrno.md +++ b/reference/cerrno.md @@ -3,6 +3,10 @@ ``ヘッダでは、標準ライブラリで発生したエラーの状態を表すマクロ`errno`、およびエラー値を表す定数マクロが定義される。 + +## フリースタンディング +このヘッダは、フリースタンディング処理系でも使用できる。本ヘッダが提供する全ての機能がフリースタンディング処理系で使用可能である。 + ## エラーマクロ | 名前 | 説明 | 対応バージョン | diff --git a/reference/cfloat.md b/reference/cfloat.md index 2039b2f203..fa37b6a82b 100644 --- a/reference/cfloat.md +++ b/reference/cfloat.md @@ -4,7 +4,8 @@ ``ヘッダでは、浮動小数点数に関連する定数値マクロを定義する。これは、C言語の標準ライブラリ``と同じである。 -本ヘッダはフリースタンディング環境でも提供される。 +## フリースタンディング +このヘッダは、フリースタンディング処理系でも使用できる。本ヘッダが提供する全ての機能がフリースタンディング処理系で使用可能である。 浮動小数点数 $x$ は以下のようにモデル化される。 diff --git a/reference/charconv.md b/reference/charconv.md index 0e4316df0f..48476c6c9a 100644 --- a/reference/charconv.md +++ b/reference/charconv.md @@ -17,6 +17,10 @@ - `#`による小数点以下の桁数指定はできない - 16進数に`0x`は付けられない + +## フリースタンディング +このヘッダの一部の機能が、フリースタンディング処理系でも使用できる。どの機能が使用できるかは各機能のページを参照。 + ## 文字列 ⇔ 数値変換関数 | 名前 | 説明 | 対応バージョン | diff --git a/reference/chrono/duration/op_constructor.md b/reference/chrono/duration/op_constructor.md index 64a1a611bd..745fc0236b 100644 --- a/reference/chrono/duration/op_constructor.md +++ b/reference/chrono/duration/op_constructor.md @@ -29,9 +29,11 @@ duration(const duration&) = default; // (4) - C++20 : [`is_convertible_v`](/reference/type_traits/is_convertible.md)` == true`であること - [`treat_as_floating_point`](/reference/chrono/treat_as_floating_point.md)`::value == true`もしくは[`treat_as_floating_point`](/reference/chrono/treat_as_floating_point.md)`::value == false`であること - (3) : - - C++11 : [`treat_as_floating_point`](/reference/chrono/treat_as_floating_point.md)`::value == true` - - C++14 : 単位変換の結果としてオーバーフローせず、[`treat_as_floating_point`](/reference/chrono/treat_as_floating_point.md)`::value == true` - - もしくは、[`treat_as_floating_point`](/reference/chrono/treat_as_floating_point.md)`::value == false`かつ[`ratio_divide`](/reference/ratio/ratio_divide.md)`::type::den == 1` + - [`is_convertible_v`](/reference/type_traits/is_convertible.md)` == true`であること + - [`ratio_divide`](/reference/ratio/ratio_divide.md)``が有効な`ratio`の特殊化であること + - 次のいずれかを満たすこと: + - [`treat_as_floating_point`](/reference/chrono/treat_as_floating_point.md)`::value == true`である + - もしくは、[`ratio_divide`](/reference/ratio/ratio_divide.md)`::den == 1`かつ[`treat_as_floating_point`](/reference/chrono/treat_as_floating_point.md)`::value == false`である - これらの要求は、整数ベースの`duration`型間での変換の際に、暗黙に切り捨て誤差が起きるのを防ぐ。浮動小数点数型ベースの場合には、精度が下がれば小数点以下の数値になるだけなので問題ない。 @@ -81,6 +83,8 @@ d5 : 3000 ## 参照 -- [LWG Issue 2094. `duration` conversion overflow shouldn't participate in overload resolution](http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2094) - [`std::chrono::duration` construction - ISO C++ Standard - Discussion](https://groups.google.com/a/isocpp.org/forum/#!topic/std-discussion/OcGX7Yj3meI) - [P2117R0 C++ Standard Library Issues Resolved Directly In Prague](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p2117r0.html) +- [LWG Issue 2094. `duration` conversion overflow shouldn't participate in overload resolution](http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2094) +- [LWG Issue 3090. What is §[time.duration.cons]p4's "no overflow is induced in the conversion" intended to mean?](https://cplusplus.github.io/LWG/issue3090) + - (3)のテンプレートパラメータ制約から意味の不明確だった「変換でオーバーフローが生じないこと」という表現が削除され、代わりに`is_convertible_v`が`true`であることと`ratio_divide`が有効な`ratio`の特殊化であることが明示された。この整理はC++26で規定されたが、実装は元々この意図どおりに制約していたため挙動は変わらない diff --git a/reference/chrono/hh_mm_ss/op_constructor.md b/reference/chrono/hh_mm_ss/op_constructor.md index 2111390663..c3b7acc364 100644 --- a/reference/chrono/hh_mm_ss/op_constructor.md +++ b/reference/chrono/hh_mm_ss/op_constructor.md @@ -27,10 +27,11 @@ hh_mm_ss(hh_mm_ss&&); // (4) C++20 - (1) : `Duration`型の値ゼロで時間を構築する - (2) : `precision`型の精度で`Duration d`をもつ`hh_mm_ss`オブジェクトを構築する - `d < Duration::`[`zero()`](/reference/chrono/duration/zero.md)である場合、負の時間とみなし[`is_negative()`](is_negative.md)が`true`を返すようにする - - [`duration_cast`](/reference/chrono/duration_cast.md)`<`[`chrono::hours`](/reference/chrono/duration_aliases.md)`>(`[`abs`](/reference/chrono/duration/abs.md)`(d))`で時を構築する - - [`duration_cast`](/reference/chrono/duration_cast.md)`<`[`chrono::minutes`](/reference/chrono/duration_aliases.md)`>(`[`abs`](/reference/chrono/duration/abs.md)`(d) -` [`hours()`](hours.md)`)`で分を構築する - - [`duration_cast`](/reference/chrono/duration_cast.md)`<`[`chrono::seconds`](/reference/chrono/duration_aliases.md)`>(`[`abs`](/reference/chrono/duration/abs.md)`(d) -` [`hours()`](hours.md) `-` [`minutes()`](minutes.md)`)`で秒を構築する - - [`treat_as_floating_point_v`](/reference/chrono/treat_as_floating_point.md)``が`true`である場合、秒未満は[`abs`](/reference/chrono/duration/abs.md)`(d) -` [`hours()`](hours.md) `-` [`minutes()`](minutes.md) `-` [`seconds()`](seconds.md)で構築する。そうでなければ、[`duration_cast`](/reference/chrono/duration_cast.md)`(`[`abs`](/reference/chrono/duration/abs.md)`(d) -` [`hours()`](hours.md) `-` [`minutes()`](minutes.md) `-` [`seconds()`](seconds.md)`)`で秒未満を構築する + - ここで、[`is_negative()`](is_negative.md)が`true`ならば`-d`を、そうでなければ`d`を表す値を`ABS_D`とする + - [`duration_cast`](/reference/chrono/duration_cast.md)`<`[`chrono::hours`](/reference/chrono/duration_aliases.md)`>(ABS_D)`で時を構築する + - [`duration_cast`](/reference/chrono/duration_cast.md)`<`[`chrono::minutes`](/reference/chrono/duration_aliases.md)`>(ABS_D -` [`hours()`](hours.md)`)`で分を構築する + - [`duration_cast`](/reference/chrono/duration_cast.md)`<`[`chrono::seconds`](/reference/chrono/duration_aliases.md)`>(ABS_D -` [`hours()`](hours.md) `-` [`minutes()`](minutes.md)`)`で秒を構築する + - [`treat_as_floating_point_v`](/reference/chrono/treat_as_floating_point.md)``が`true`である場合、秒未満は`ABS_D -` [`hours()`](hours.md) `-` [`minutes()`](minutes.md) `-` [`seconds()`](seconds.md)で構築する。そうでなければ、[`duration_cast`](/reference/chrono/duration_cast.md)`(ABS_D -` [`hours()`](hours.md) `-` [`minutes()`](minutes.md) `-` [`seconds()`](seconds.md)`)`で秒未満を構築する ## 事後条件 @@ -98,3 +99,8 @@ int main() - [Clang](/implementation.md#clang): 10.0 [mark verified] - [GCC](/implementation.md#gcc): 11.1 [mark verified] - [Visual C++](/implementation.md#visual_cpp): 2019 Update 3 [mark noimpl] + + +## 参照 +- [LWG Issue 4274. The `chrono::hh_mm_ss` constructor is ill-formed for unsigned durations](https://cplusplus.github.io/LWG/issue4274) + - C++26で、効果の記述が`abs(d)`を用いる形から、`is_negative()`が`true`なら`-d`・そうでなければ`d`を表す`ABS_D`を用いる形へ修正された。`abs`は符号なし`Duration`に対して不適格となるため、符号なしの時間間隔型でも構築できるようにするもの diff --git a/reference/chrono/local_time.md b/reference/chrono/local_time.md index 9217f25c1b..94d4611480 100644 --- a/reference/chrono/local_time.md +++ b/reference/chrono/local_time.md @@ -52,6 +52,11 @@ namespace std { - (7) : `local_time`型に対する[`std::formatter`](/reference/format/formatter.md)クラステンプレートの特殊化 +## テンプレートパラメータ制約 +- (5) : + - C++26 : 式`os << `[`sys_time`](sys_time.md)`{tp.`[`time_since_epoch()`](time_point/time_since_epoch.md)`}`が有効な式であること + + ## 効果 - (5) : 以下と等価: ```cpp @@ -242,3 +247,8 @@ int main() ## 関連項目 - [chronoの`std::format()`](/reference/chrono/format.md) (出力フォーマットの詳細) - [chronoの`parse()`](/reference/chrono/parse.md) (入力フォーマットの詳細) + + +## 参照 +- [LWG Issue 4257. Stream insertion for `chrono::local_time` should be constrained](https://cplusplus.github.io/LWG/issue4257) + - C++26で、(5)のストリーム挿入演算子に「`os << sys_time{tp.time_since_epoch()}`が有効な式であること」というテンプレートパラメータ制約が追加された。基となる`sys_time`の出力が不可能な場合にオーバーロード解決から除外されるようになった diff --git a/reference/climits.md b/reference/climits.md index 758f21f1de..021fa82012 100644 --- a/reference/climits.md +++ b/reference/climits.md @@ -3,7 +3,8 @@ ``ヘッダでは、整数型に関するマクロが定義されている。これは、C言語の標準ライブラリ``と同じである。 -本ヘッダはフリースタンディング環境でも提供される。 +## フリースタンディング +このヘッダは、フリースタンディング処理系でも使用できる。本ヘッダが提供する全ての機能がフリースタンディング処理系で使用可能である。 ## 最小値 diff --git a/reference/cmath.md b/reference/cmath.md index 2d343e049f..77fe39f748 100644 --- a/reference/cmath.md +++ b/reference/cmath.md @@ -28,6 +28,9 @@ - [その他のマクロ](#other-macros) +## フリースタンディング +このヘッダの一部の機能が、フリースタンディング処理系でも使用できる。どの機能が使用できるかは各機能のページを参照。 + ## 標準Cライブラリとの差異 ``は基本的には、標準 C ライブラリの `` に準拠しているが、いくつかの変更点がある。 diff --git a/reference/cmath/abs.md b/reference/cmath/abs.md index 019c59eece..75b5e59258 100644 --- a/reference/cmath/abs.md +++ b/reference/cmath/abs.md @@ -49,6 +49,8 @@ namespace std { ## 備考 +整数版のオーバーロードは、フリースタンディング処理系でも使用できる。 + - $$ f(x) = | x | $$ - (6), (7), (8) : 引数の絶対値が、戻り値の型で表現できない場合、未定義動作を引き起こす。 - 一般的な2の補数表現のシステムにおいて、符号付き整数型の最小値(例:`int`における[`INT_MIN`](/reference/climits/int_min.md))の絶対値は、表現できる最大値([`INT_MAX`](/reference/climits/int_max.md))よりも1大きくなってしまうため、この未定義動作に該当する。 diff --git a/reference/compare.md b/reference/compare.md index 3e8477322c..c5059d2595 100644 --- a/reference/compare.md +++ b/reference/compare.md @@ -9,7 +9,8 @@ 比較カテゴリ型を返す`<=>`を利用する際は本ヘッダのインクルードは必須である。 -本ヘッダはフリースタンディング環境でも提供される。 +## フリースタンディング +このヘッダは、フリースタンディング処理系でも使用できる。本ヘッダが提供する全ての機能がフリースタンディング処理系で使用可能である。 ## 代入可能性(*substitutability*) diff --git a/reference/compare/type_order.md b/reference/compare/type_order.md index 2e6a3e18ff..35643a8ff6 100644 --- a/reference/compare/type_order.md +++ b/reference/compare/type_order.md @@ -43,6 +43,7 @@ namespace std { - C++26より前は、型の全順序を得るためには`__PRETTY_FUNCTION__`等の処理系固有の機能を使うか、`typeid`を実行時に比較する必要があった。`type_order`は、コンパイル時に取得できる、実装定義であるが安定した型の全順序を提供する - このクラスは不完全型に対しても動作する - 実装定義の全順序の具体的な順番には依存すべきではないが、同じ実装のなかでは翻訳単位の境界をまたいでも安定する +- `type_order`をユーザーが明示的に特殊化・部分特殊化することは禁止されている。そのような宣言を行った場合、プログラムは不適格となる ## 例 @@ -93,3 +94,5 @@ int main() { - [P2830R10 Constexpr Type Ordering](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p2830r10.html) - [P3778R0 Fix for `type_order` template definition](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3778r0.html) - [P4140R0 Proposed resolution for US70-126: allow incomplete types in `type_order`](https://open-std.org/jtc1/sc22/wg21/docs/papers/2026/p4140r0.html) +- [LWG Issue 4305. Missing user requirements on `type_order` template](https://cplusplus.github.io/LWG/issue4305) + - C++26で、ユーザーが`type_order`の明示的特殊化・部分特殊化を宣言するとプログラムが不適格となることが規定された diff --git a/reference/concepts.md b/reference/concepts.md index ca1b21515a..656f672cda 100644 --- a/reference/concepts.md +++ b/reference/concepts.md @@ -6,7 +6,8 @@ ``ヘッダでは基礎的なコンセプトの実装を提供する。これらのコンセプトは標準ライブラリでも使用される。 -本ヘッダはフリースタンディング環境でも提供される。 +## フリースタンディング +このヘッダは、フリースタンディング処理系でも使用できる。本ヘッダが提供する全ての機能がフリースタンディング処理系で使用可能である。 ## 暗黙の意味論的な制約 diff --git a/reference/condition_variable/condition_variable/wait_for.md b/reference/condition_variable/condition_variable/wait_for.md index 0039cf9681..4adf6efb03 100644 --- a/reference/condition_variable/condition_variable/wait_for.md +++ b/reference/condition_variable/condition_variable/wait_for.md @@ -8,12 +8,19 @@ ```cpp template cv_status wait_for(unique_lock& lock, - const chrono::duration& rel_time); // (1) + const chrono::duration& rel_time); // (1) C++11 +template +cv_status wait_for(unique_lock& lock, + chrono::duration rel_time); // (1) C++26 template bool wait_for(unique_lock& lock, const chrono::duration& rel_time, - Predicate pred); // (2) + Predicate pred); // (2) C++11 +template +bool wait_for(unique_lock& lock, + chrono::duration rel_time, + Predicate pred); // (2) C++26 ``` * cv_status[link /reference/condition_variable/cv_status.md] * unique_lock[link /reference/mutex/unique_lock.md] @@ -176,3 +183,5 @@ process data - [LWG Issue 2135. Unclear requirement for exceptions thrown in `condition_variable::wait()`](http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2135) - [LWG Issue 3504. `condition_variable::wait_for` is overspecified](https://cplusplus.github.io/LWG/issue3504) - C++26で、相対時間を絶対時間へ変換する際に`ceil`で整数時間へ丸めるよう変更され、浮動小数点の`duration`での精度の問題が修正された。この変更は欠陥報告 (DR) であり、C++26より前のバージョンでもコンパイラが早期に対応している場合がある +- [LWG Issue 4301. `condition_variable{_any}::wait_{for, until}` should take timeout by value](https://cplusplus.github.io/LWG/issue4301) + - C++26で、`wait_until`/`wait_for`のタイムアウト引数(`time_point`/`duration`)が`const`参照渡しから値渡しへ変更された diff --git a/reference/condition_variable/condition_variable/wait_until.md b/reference/condition_variable/condition_variable/wait_until.md index d67be55142..fccedd99bd 100644 --- a/reference/condition_variable/condition_variable/wait_until.md +++ b/reference/condition_variable/condition_variable/wait_until.md @@ -8,12 +8,19 @@ ```cpp template cv_status wait_until(unique_lock& lock, - const chrono::time_point& abs_time); // (1) + const chrono::time_point& abs_time); // (1) C++11 +template +cv_status wait_until(unique_lock& lock, + chrono::time_point abs_time); // (1) C++26 template bool wait_until(unique_lock& lock, const chrono::time_point& abs_time, - Predicate pred); // (2) + Predicate pred); // (2) C++11 +template +bool wait_until(unique_lock& lock, + chrono::time_point abs_time, + Predicate pred); // (2) C++26 ``` * cv_status[link /reference/condition_variable/cv_status.md] * unique_lock[link /reference/mutex/unique_lock.md] @@ -197,3 +204,5 @@ process data - [LWG Issue 2135. Unclear requirement for exceptions thrown in `condition_variable::wait()`](http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2135) - [Bug 41861 (DR887) - [DR 887][C++0x] `` does not use `monotonic_clock`](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=41861) - GCC 10から`steady_clock`がサポートされた +- [LWG Issue 4301. `condition_variable{_any}::wait_{for, until}` should take timeout by value](https://cplusplus.github.io/LWG/issue4301) + - C++26で、`wait_until`/`wait_for`のタイムアウト引数(`time_point`/`duration`)が`const`参照渡しから値渡しへ変更された diff --git a/reference/condition_variable/condition_variable_any/wait_for.md b/reference/condition_variable/condition_variable_any/wait_for.md index a26059d8f3..69338a285e 100644 --- a/reference/condition_variable/condition_variable_any/wait_for.md +++ b/reference/condition_variable/condition_variable_any/wait_for.md @@ -8,18 +8,30 @@ ```cpp template cv_status wait_for(Lock& lock, - const chrono::duration& rel_time); // (1) + const chrono::duration& rel_time); // (1) C++11 +template +cv_status wait_for(Lock& lock, + chrono::duration rel_time); // (1) C++26 template bool wait_for(Lock& lock, const chrono::duration& rel_time, - Predicate pred); // (2) + Predicate pred); // (2) C++11 +template +bool wait_for(Lock& lock, + chrono::duration rel_time, + Predicate pred); // (2) C++26 template bool wait_for(Lock& lock, stop_token stoken, const chrono::duration& rel_time, - Predicate pred); // (3) C++20 から + Predicate pred); // (3) C++20 +template +bool wait_for(Lock& lock, + stop_token stoken, + chrono::duration rel_time, + Predicate pred); // (3) C++26 ``` * cv_status[link /reference/condition_variable/cv_status.md] * stop_token[link /reference/stop_token/stop_token.md] @@ -187,3 +199,5 @@ process data - [P1869R1 Rename `condition_variable_any` interruptible wait methods](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1869r1.html) - [LWG Issue 3504. `condition_variable::wait_for` is overspecified](https://cplusplus.github.io/LWG/issue3504) - C++26で、相対時間を絶対時間へ変換する際に`ceil`で整数時間へ丸めるよう変更され、浮動小数点の`duration`での精度の問題が修正された。この変更は欠陥報告 (DR) であり、C++26より前のバージョンでもコンパイラが早期に対応している場合がある +- [LWG Issue 4301. `condition_variable{_any}::wait_{for, until}` should take timeout by value](https://cplusplus.github.io/LWG/issue4301) + - C++26で、`wait_until`/`wait_for`のタイムアウト引数(`time_point`/`duration`)が`const`参照渡しから値渡しへ変更された diff --git a/reference/condition_variable/condition_variable_any/wait_until.md b/reference/condition_variable/condition_variable_any/wait_until.md index 50d998e089..f5c2a81470 100644 --- a/reference/condition_variable/condition_variable_any/wait_until.md +++ b/reference/condition_variable/condition_variable_any/wait_until.md @@ -8,18 +8,30 @@ ```cpp template cv_status wait_until(Lock& lock, - const chrono::time_point& abs_time); // (1) + const chrono::time_point& abs_time); // (1) C++11 +template +cv_status wait_until(Lock& lock, + chrono::time_point abs_time); // (1) C++26 template bool wait_until(Lock& lock, const chrono::time_point& abs_time, - Predicate pred); // (2) + Predicate pred); // (2) C++11 +template +bool wait_until(Lock& lock, + chrono::time_point abs_time, + Predicate pred); // (2) C++26 template bool wait_until(Lock& lock, stop_token stoken, const chrono::time_point& abs_time, - Predicate pred); // (3) C++20 から + Predicate pred); // (3) C++20 +template +bool wait_until(Lock& lock, + stop_token stoken, + chrono::time_point abs_time, + Predicate pred); // (3) C++26 ``` * cv_status[link /reference/condition_variable/cv_status.md] * time_point[link /reference/chrono/time_point.md] @@ -218,3 +230,5 @@ process data - GCC 10から`steady_clock`がサポートされた - [P0660R10 Stop Token and Joining Thread, Rev 10](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p0660r10.pdf) - [P1869R1 Rename `condition_variable_any` interruptible wait methods](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1869r1.html) +- [LWG Issue 4301. `condition_variable{_any}::wait_{for, until}` should take timeout by value](https://cplusplus.github.io/LWG/issue4301) + - C++26で、`wait_until`/`wait_for`のタイムアウト引数(`time_point`/`duration`)が`const`参照渡しから値渡しへ変更された diff --git a/reference/contracts.md b/reference/contracts.md index 9381996681..e24a52172a 100644 --- a/reference/contracts.md +++ b/reference/contracts.md @@ -9,6 +9,10 @@ このヘッダで提供される機能は、ユーザー定義の契約違反ハンドラ(`handle_contract_violation`関数)を記述するために使用することを主な目的としており、契約アサーション(`pre`、`post`、`contract_assert`)を記述するためにこのヘッダをインクルードする必要はない。 + +## フリースタンディング +このヘッダは、フリースタンディング処理系でも使用できる。本ヘッダが提供する全ての機能がフリースタンディング処理系で使用可能である。 + このヘッダのすべての宣言は名前空間`std::contracts`に属する。 ## 列挙型 diff --git a/reference/coroutine.md b/reference/coroutine.md index 2797c28776..cf60bb4971 100644 --- a/reference/coroutine.md +++ b/reference/coroutine.md @@ -10,7 +10,8 @@ - [``](compare.md) (C++20) -本ヘッダはフリースタンディング環境でも提供される。 +## フリースタンディング +このヘッダは、フリースタンディング処理系でも使用できる。本ヘッダが提供する全ての機能がフリースタンディング処理系で使用可能である。 ## コルーチントレイト diff --git a/reference/cstddef.md b/reference/cstddef.md index fc9e0fca5c..904dcc0623 100644 --- a/reference/cstddef.md +++ b/reference/cstddef.md @@ -3,7 +3,9 @@ ``ヘッダでは基本的な型、値、マクロを定義する。 -本ヘッダはフリースタンディング環境でも提供される。 + +## フリースタンディング +このヘッダは、フリースタンディング処理系でも使用できる。本ヘッダが提供する全ての機能がフリースタンディング処理系で使用可能である。 ## 型 diff --git a/reference/cstdint.md b/reference/cstdint.md index 01d9fc91e6..fa471ce38b 100644 --- a/reference/cstdint.md +++ b/reference/cstdint.md @@ -4,7 +4,8 @@ ``ヘッダでは、ビット数が規定された整数型の別名、およびマクロを提供する。これらの機能は、`std`名前空間に属することを除いてC言語の標準ライブラリ``ヘッダと同じである。 -本ヘッダはフリースタンディング環境でも提供される。 +## フリースタンディング +このヘッダは、フリースタンディング処理系でも使用できる。本ヘッダが提供する全ての機能がフリースタンディング処理系で使用可能である。 ## 符号付き整数型 diff --git a/reference/cstdlib.md b/reference/cstdlib.md index d6b7ce6400..4b2c32c39c 100644 --- a/reference/cstdlib.md +++ b/reference/cstdlib.md @@ -3,12 +3,13 @@ ``ヘッダでは、一般的なユーティリティの関数を定義する。これらの機能は基本的には、`std`名前空間に属することを除いてC言語の標準ライブラリ``ヘッダと同じである。 -本ヘッダはフリースタンディング環境でも提供される。 -フリースタンディング環境の場合、少なくとも`abort`, `atexit`, `at_quick_exit`, `exit`, `quick_exit`関数がサポートされる。 - ただし、一部の機能には、`[[noreturn]]`属性、`noexcept`キーワード、スレッドローカルストレージのような、C++特有の言語機能に関する規定がある。 +## フリースタンディング +このヘッダの一部の機能は、フリースタンディング処理系でも使用できる。具体的には、型`size_t`・`div_t`・`ldiv_t`・`lldiv_t`、マクロ`NULL`・`EXIT_FAILURE`・`EXIT_SUCCESS`、関数`abort`・`atexit`・`at_quick_exit`・`exit`・`_Exit`・`quick_exit`・`memalignment`・`bsearch`・`qsort`・整数版の`abs`/`labs`/`llabs`・`div`/`ldiv`/`lldiv`が、フリースタンディング処理系で使用可能である(浮動小数点数版の`abs`は、フリースタンディング処理系では削除される)。 + + ## 数値変換 | 名前 | 説明 | 対応バージョン | diff --git a/reference/cstdlib/abort.md b/reference/cstdlib/abort.md index cf3d5ac90b..aa806617ec 100644 --- a/reference/cstdlib/abort.md +++ b/reference/cstdlib/abort.md @@ -32,6 +32,10 @@ raise(SIGABRT); この関数は決して返らない。 + +## 備考 +この関数は、フリースタンディング処理系でも使用できる。 + ## 例 ```cpp example #include diff --git a/reference/cstdlib/abs.md b/reference/cstdlib/abs.md index cc4fe877de..84cf1af9bc 100644 --- a/reference/cstdlib/abs.md +++ b/reference/cstdlib/abs.md @@ -63,6 +63,8 @@ namespace std { ## 備考 +整数版のオーバーロードは、フリースタンディング処理系でも使用できる。 + - (1), (2), (3), (8), (9) : 引数の絶対値が、戻り値の型で表現できない場合、未定義動作を引き起こす。 - 一般的な2の補数表現のシステムにおいて、符号付き整数型の最小値(例:`int`における[`INT_MIN`](/reference/climits/int_min.md))の絶対値は、表現できる最大値([`INT_MAX`](/reference/climits/int_max.md))よりも1大きくなってしまうため、この未定義動作に該当する。 - パラメータの型`X`において[`is_unsigned_v`](/reference/type_traits/is_unsigned.md)``が`true`であり、`X`が整数昇格によって`int`に変換できない場合、プログラムは不適格となる diff --git a/reference/cstdlib/at_quick_exit.md b/reference/cstdlib/at_quick_exit.md index 85503f8336..a2bce4c4dc 100644 --- a/reference/cstdlib/at_quick_exit.md +++ b/reference/cstdlib/at_quick_exit.md @@ -26,6 +26,8 @@ namespace std { ## 備考 +この関数は、フリースタンディング処理系でも使用できる。 + この関数では、複数の関数を登録できる。 登録できる上限数は実装定義だが、32個以上は登録できることが実装に要求される。 diff --git a/reference/cstdlib/atexit.md b/reference/cstdlib/atexit.md index d24103f229..ab5bf132a1 100644 --- a/reference/cstdlib/atexit.md +++ b/reference/cstdlib/atexit.md @@ -33,6 +33,8 @@ namespace std { ## 備考 +この関数は、フリースタンディング処理系でも使用できる。 + この関数では、複数の関数を登録できる。 登録できる上限数は実装定義だが、32個以上は登録できることが実装に要求される。 diff --git a/reference/cstdlib/bsearch.md b/reference/cstdlib/bsearch.md index f7ba2a15ed..156a2959dc 100644 --- a/reference/cstdlib/bsearch.md +++ b/reference/cstdlib/bsearch.md @@ -64,6 +64,8 @@ namespace std { ## 備考 +この関数は、フリースタンディング処理系でも使用できる。 + - C++26では、`const`修飾を保持するオーバーロード (3), (4) が追加された。これにより、`const`な配列を探索した結果として`const void*`が返るようになり、`const`な配列の要素を結果経由で書き換えてしまう不適切なコードを防げる - 同時に、非`const`の配列を受け取る(1), (2)は引数`base`が`void*`となり、非`const`なポインタを返す diff --git a/reference/cstdlib/div.md b/reference/cstdlib/div.md index 57970c5c82..85da2e3f52 100644 --- a/reference/cstdlib/div.md +++ b/reference/cstdlib/div.md @@ -84,6 +84,8 @@ int main() ### 備考 +この関数は、フリースタンディング処理系でも使用できる。 + 特定の環境では、早期に `constexpr` 対応されている場合がある: - GCC 4.6.1 以上 diff --git a/reference/cstdlib/div_t.md b/reference/cstdlib/div_t.md index d6371fbf8e..df18446e45 100644 --- a/reference/cstdlib/div_t.md +++ b/reference/cstdlib/div_t.md @@ -18,6 +18,10 @@ namespace std { `quot`は「quotient (商)」、`rem`は「remainder (剰余)」。 + +## 備考 +この型は、フリースタンディング処理系でも使用できる。 + ## 例 ```cpp example #include diff --git a/reference/cstdlib/exit.md b/reference/cstdlib/exit.md index 9d2ae8c241..9fac58465b 100644 --- a/reference/cstdlib/exit.md +++ b/reference/cstdlib/exit.md @@ -40,6 +40,10 @@ namespace std { この関数は決して返らない。 + +## 備考 +この関数は、フリースタンディング処理系でも使用できる。 + ## 例 ```cpp example #include diff --git a/reference/cstdlib/exit_.md b/reference/cstdlib/exit_.md index fadfed5ba8..cae1e5ad05 100644 --- a/reference/cstdlib/exit_.md +++ b/reference/cstdlib/exit_.md @@ -35,6 +35,8 @@ namespace std { ## 備考 +この関数は、フリースタンディング処理系でも使用できる。 + この関数は、C99で導入され、C++に取り込んだものである。C++では、この関数の代わりに[`quick_exit()`](quick_exit.md)関数を使用することを推奨する。 diff --git a/reference/cstdlib/exit_failure.md b/reference/cstdlib/exit_failure.md index 366c8e74ee..8c4742eb09 100644 --- a/reference/cstdlib/exit_failure.md +++ b/reference/cstdlib/exit_failure.md @@ -14,6 +14,10 @@ このマクロの値は、[`exit()`](exit.md)関数や[`quick_exit()`](quick_exit.md)関数の引数として指定する。そうすることで、プログラムが異常終了したことを、ホスト環境に伝えられる。このマクロのほかに、`0`以外の整数値を指定して異常終了とすることもできる。 + +## 備考 +このマクロは、フリースタンディング処理系でも使用できる。 + ## 例 ```cpp example #include diff --git a/reference/cstdlib/exit_success.md b/reference/cstdlib/exit_success.md index 6748ee8b57..7177bcf34b 100644 --- a/reference/cstdlib/exit_success.md +++ b/reference/cstdlib/exit_success.md @@ -14,6 +14,10 @@ このマクロの値は、[`exit()`](exit.md)関数や[`quick_exit()`](quick_exit.md)関数の引数として指定する。そうすることで、プログラムが正常終了したことを、ホスト環境に伝えられる。このマクロのほかに、`0`を指定して正常終了とすることもできる。 + +## 備考 +このマクロは、フリースタンディング処理系でも使用できる。 + ## 例 ```cpp example #include diff --git a/reference/cstdlib/ldiv_t.md b/reference/cstdlib/ldiv_t.md index 1a3f454b04..4e6213eb6a 100644 --- a/reference/cstdlib/ldiv_t.md +++ b/reference/cstdlib/ldiv_t.md @@ -18,6 +18,10 @@ namespace std { `quot`は「quotient (商)」、`rem`は「remainder (剰余)」。 + +## 備考 +この型は、フリースタンディング処理系でも使用できる。 + ## 例 ```cpp example #include diff --git a/reference/cstdlib/lldiv_t.md b/reference/cstdlib/lldiv_t.md index 07b24ae6d2..762d562b39 100644 --- a/reference/cstdlib/lldiv_t.md +++ b/reference/cstdlib/lldiv_t.md @@ -19,6 +19,10 @@ namespace std { `quot`は「quotient (商)」、`rem`は「remainder (剰余)」。 + +## 備考 +この型は、フリースタンディング処理系でも使用できる。 + ## 例 ```cpp example #include diff --git a/reference/cstdlib/quick_exit.md b/reference/cstdlib/quick_exit.md index 444a76f440..ac1a7c4d2f 100644 --- a/reference/cstdlib/quick_exit.md +++ b/reference/cstdlib/quick_exit.md @@ -35,6 +35,10 @@ namespace std { この関数は決して返らない。 + +## 備考 +この関数は、フリースタンディング処理系でも使用できる。 + ## 例 ```cpp example #include diff --git a/reference/cstring.md b/reference/cstring.md index 509efc5c8c..fc037ee045 100644 --- a/reference/cstring.md +++ b/reference/cstring.md @@ -4,6 +4,9 @@ ``ヘッダでは、文字列操作関数を定義する。これらの機能は、`std`名前空間に属することを除いてC言語の標準ライブラリ``ヘッダと同じである。 +## フリースタンディング +このヘッダのほとんどの機能は、フリースタンディング処理系でも使用できる。ただし、例外を送出する一部の機能などは、フリースタンディング処理系では提供されない、または削除される。詳細は各機能のページを参照。 + ## 型 | 名前 | 説明 | 対応バージョン | diff --git a/reference/debugging.md b/reference/debugging.md index c330a524ea..d491d7d731 100644 --- a/reference/debugging.md +++ b/reference/debugging.md @@ -4,6 +4,10 @@ ``ヘッダでは、プログラムのデバッグ実行をサポートする機能を提供する。 + +## フリースタンディング +このヘッダは、フリースタンディング処理系でも使用できる。本ヘッダが提供する全ての機能がフリースタンディング処理系で使用可能である。 + | 名前 | 説明 | 対応バージョン | |------|------|----------------| | [`breakpoint`](debugging/breakpoint.md) | ブレークポイントを設置する (function) | C++26 | diff --git a/reference/exception.md b/reference/exception.md index 734f5584a0..74892ecd96 100644 --- a/reference/exception.md +++ b/reference/exception.md @@ -3,7 +3,8 @@ ``ヘッダでは、C++プログラムでの例外の扱いに関連した、いくつかのクラスと関数を定義する。 -本ヘッダはフリースタンディング環境でも提供される。 +## フリースタンディング +このヘッダは、フリースタンディング処理系でも使用できる。本ヘッダが提供する全ての機能がフリースタンディング処理系で使用可能である。 | 名前 | 説明 | 対応バージョン | |-------------------------------------------------|-----------------------------------------------|-------| diff --git a/reference/execution.md b/reference/execution.md index 0ba47ce88b..8fab40f2de 100644 --- a/reference/execution.md +++ b/reference/execution.md @@ -5,6 +5,9 @@ ``ヘッダでは、アルゴリズムの並列実行を許可するための実行ポリシー、汎用的な非同期実行フレームワークとしての実行制御ライブラリを定義する。 +## フリースタンディング +このヘッダの一部の機能が、フリースタンディング処理系でも使用できる。どの機能が使用できるかは各機能のページを参照。 + ## 実行ポリシー(C++17) | 名前 | 説明 | 対応バージョン | diff --git a/reference/execution/is_execution_policy.md b/reference/execution/is_execution_policy.md index 0490978b3e..ef97f00fa9 100644 --- a/reference/execution/is_execution_policy.md +++ b/reference/execution/is_execution_policy.md @@ -21,6 +21,8 @@ namespace std { ## 備考 +この型特性は、フリースタンディング処理系でも使用できる。 + このクラステンプレートを特殊化した場合の動作は未定義となる。 diff --git a/reference/expected.md b/reference/expected.md index 53e2ebc695..f792447916 100644 --- a/reference/expected.md +++ b/reference/expected.md @@ -5,6 +5,10 @@ ``ヘッダでは、任意の正常値または任意のエラー値のどちらかを持たせられるオブジェクトの型を定義する。 +## フリースタンディング +このヘッダのほとんどの機能は、フリースタンディング処理系でも使用できる。ただし、[`expected::value()`](expected/expected/value.md)メンバ関数は、エラー値を保持しているときに例外を送出するため、フリースタンディング処理系では削除される。 + + | 名前 | 説明 | 対応バージョン | |-----------------|----------------|-------| | [`expected`](expected/expected.md) | 正常値かエラー値を保持するオブジェクト (class template) | C++23 | diff --git a/reference/expected/expected.void/op_equal.md b/reference/expected/expected.void/op_equal.md index f72459f704..61f2dc1ba2 100644 --- a/reference/expected/expected.void/op_equal.md +++ b/reference/expected/expected.void/op_equal.md @@ -32,8 +32,8 @@ friend constexpr bool operator==(const unexpected& e, const expected& x); ## 戻り値 - (1) : 次の値を返す - `x.`[`has_value()`](has_value.md)と`y.`[`has_value()`](has_value.md)が異なるとき、`false` - - そうでなければ、`x.`[`has_value()`](has_value.md) `|| static_cast(x.`[`error()`](error.md) `== y.`[`error()`](error.md)`)` -- (2), (3) : `!x.`[`has_value()`](has_value.md) `&& static_cast(x.`[`error()`](error.md) `== e.`[`error()`](../unexpected/error.md)`)` + - そうでなければ、`x.`[`has_value()`](has_value.md) `== true`のとき`true`、そうでなければ`x.`[`error()`](error.md) `== y.`[`error()`](error.md) +- (2), (3) : `!x.`[`has_value()`](has_value.md) `== true`のとき`x.`[`error()`](error.md) `== e.`[`error()`](../unexpected/error.md)、そうでなければ`false` ## 例 @@ -82,3 +82,5 @@ int main() - [P0323R12 std::expected](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p0323r12.html) - [P3379R0 Constrain `std::expected` equality operators](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3379r0.html) - C++26で「適格要件」を「テンプレートパラメータ制約」に変更 +- [LWG Issue 4366. Heterogeneous comparison of `expected` may be ill-formed](https://cplusplus.github.io/LWG/issue4366) + - C++26で、戻り値が`static_cast(…)`を用いた形式から条件式へ変更された。比較結果を`bool`へ明示変換していたことで異種比較が不適格になりうる問題を防ぐもの diff --git a/reference/expected/expected.void/value.md b/reference/expected/expected.void/value.md index 90860355ba..01fb8a2d4e 100644 --- a/reference/expected/expected.void/value.md +++ b/reference/expected/expected.void/value.md @@ -19,6 +19,10 @@ constexpr void value() &&; // (2) なし + +## 備考 +この関数は、例外を送出しうるため、フリースタンディング処理系では削除される(フリースタンディング処理系では使用できない)。 + ## 例外 - (1) : エラー値を保持していたら、例外[`bad_expected_access`](../bad_expected_access.md)`(`[`error()`](error.md)`)`を送出する - (2) : エラー値を保持していたら、例外[`bad_expected_access`](../bad_expected_access.md)`(`[`std::move`](/reference/utility/move.md)`(`[`error()`](error.md)`))`を送出する diff --git a/reference/expected/expected/op_equal.md b/reference/expected/expected/op_equal.md index d491fff228..e3abcbf74c 100644 --- a/reference/expected/expected/op_equal.md +++ b/reference/expected/expected/op_equal.md @@ -41,8 +41,8 @@ friend constexpr bool operator==(const unexpected& e, const expected& x); // - `x.`[`has_value()`](has_value.md)と`y.`[`has_value()`](has_value.md)が異なるとき、`false` - `x.`[`has_value()`](has_value.md) `== true`のとき、[`*x`](op_deref.md) `==` [`*y`](op_deref.md) - `x.`[`error()`](error.md) `== y.`[`error()`](error.md) -- (2), (3) : `x.`[`has_value()`](has_value.md) `&& static_cast(`[`*x`](op_deref.md) `== v)` -- (4), (5) : `!x.`[`has_value()`](has_value.md) `&& static_cast(x.`[`error()`](error.md) `== e.`[`error()`](../unexpected/error.md)`)` +- (2), (3) : `x.`[`has_value()`](has_value.md) `== true`のとき[`*x`](op_deref.md) `== v`、そうでなければ`false` +- (4), (5) : `!x.`[`has_value()`](has_value.md) `== true`のとき`x.`[`error()`](error.md) `== e.`[`error()`](../unexpected/error.md)、そうでなければ`false` ## 例 @@ -95,3 +95,5 @@ int main() - [P0323R12 std::expected](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p0323r12.html) - [P3379R0 Constrain `std::expected` equality operators](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3379r0.html) - C++26で「適格要件」を「テンプレートパラメータ制約」に変更 +- [LWG Issue 4366. Heterogeneous comparison of `expected` may be ill-formed](https://cplusplus.github.io/LWG/issue4366) + - C++26で、(2), (3), (4), (5)の戻り値が`has_value() && static_cast(…)`形式から条件式(`has_value()`が`true`のとき比較結果、そうでなければ`false`)へ変更された。比較結果を`bool`へ明示変換していたことで異種比較が不適格になりうる問題を防ぐもの diff --git a/reference/expected/expected/value.md b/reference/expected/expected/value.md index 74e1296191..e3dc3af1a2 100644 --- a/reference/expected/expected/value.md +++ b/reference/expected/expected/value.md @@ -23,6 +23,10 @@ constexpr T&& value() &&; // (4) - (3), (4) : 正常値を保持していたら、[`std::move`](/reference/utility/move.md)`(val)` + +## 備考 +この関数は、例外を送出しうるため、フリースタンディング処理系では削除される(フリースタンディング処理系では使用できない)。 + ## 例外 - (1), (2) : エラー値を保持していたら、例外[`bad_expected_access`](../bad_expected_access.md)`(`[`error()`](error.md)`)`を送出する - (3), (4) : エラー値を保持していたら、例外[`bad_expected_access`](../bad_expected_access.md)`(`[`std::move`](/reference/utility/move.md)`(`[`error()`](error.md)`))`を送出する diff --git a/reference/flat_set/flat_multiset/erase.md b/reference/flat_set/flat_multiset/erase.md index 176f428e00..262d0b43bf 100644 --- a/reference/flat_set/flat_multiset/erase.md +++ b/reference/flat_set/flat_multiset/erase.md @@ -6,8 +6,9 @@ * cpp23[meta cpp] ```cpp -iterator erase(iterator position); // (1) C++23 -constexpr iterator erase(iterator position); // (1) C++26 +iterator erase(iterator position); // (1) C++23 +constexpr iterator erase(iterator position) + requires (!same_as); // (1) C++26 iterator erase(const_iterator position); // (2) C++23 constexpr iterator erase(const_iterator position); // (2) C++26 @@ -147,3 +148,5 @@ int main() ## 参照 - [P3372R3 constexpr containers and adaptors](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3372r3.html) +- [LWG Issue 4384. `flat_set::erase(iterator)` is underconstrained](https://cplusplus.github.io/LWG/issue4384) + - C++26で、(1) `erase(iterator)`に`requires (!same_as)`制約が追加された。`iterator`と`const_iterator`が同じ型のとき(2) `erase(const_iterator)`と衝突する問題を防ぐもの diff --git a/reference/flat_set/flat_set/erase.md b/reference/flat_set/flat_set/erase.md index 76375802e9..626843ae91 100644 --- a/reference/flat_set/flat_set/erase.md +++ b/reference/flat_set/flat_set/erase.md @@ -6,8 +6,9 @@ * cpp23[meta cpp] ```cpp -iterator erase(iterator position); // (1) C++23 -constexpr iterator erase(iterator position); // (1) C++26 +iterator erase(iterator position); // (1) C++23 +constexpr iterator erase(iterator position) + requires (!same_as); // (1) C++26 iterator erase(const_iterator position); // (2) C++23 constexpr iterator erase(const_iterator position); // (2) C++26 @@ -147,3 +148,5 @@ int main() ## 参照 - [P3372R3 constexpr containers and adaptors](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3372r3.html) +- [LWG Issue 4384. `flat_set::erase(iterator)` is underconstrained](https://cplusplus.github.io/LWG/issue4384) + - C++26で、(1) `erase(iterator)`に`requires (!same_as)`制約が追加された。`iterator`と`const_iterator`が同じ型のとき(2) `erase(const_iterator)`と衝突する問題を防ぐもの diff --git a/reference/format/enable_nonlocking_formatter_optimization.md b/reference/format/enable_nonlocking_formatter_optimization.md index 3ac718bf4a..3352e6bf70 100644 --- a/reference/format/enable_nonlocking_formatter_optimization.md +++ b/reference/format/enable_nonlocking_formatter_optimization.md @@ -39,7 +39,16 @@ inline constexpr bool enable_nonlocking_formatter_optimization = false; ```cpp template inline constexpr bool enable_nonlocking_formatter_optimization> = - (enable_nonlocking_formatter_optimization && ...); + (enable_nonlocking_formatter_optimization> && ...); +``` +* remove_cvref_t[link /reference/type_traits/remove_cvref.md] + +コンテナアダプタ[`std::queue`](/reference/queue/queue.md)、[`std::priority_queue`](/reference/queue/priority_queue.md)、[`std::stack`](/reference/stack/stack.md)に対しては、以下が定義される: + +```cpp +template +inline constexpr bool enable_nonlocking_formatter_optimization> = false; +// priority_queue、stackに対しても同様に false が定義される ``` @@ -66,3 +75,7 @@ inline constexpr bool enable_nonlocking_formatter_optimization`のように、パラメータに名前を付けることもできるが、名前は単に無視される diff --git a/reference/functional/move_only_function.md b/reference/functional/move_only_function.md index 8ebd6e675a..04221562ff 100644 --- a/reference/functional/move_only_function.md +++ b/reference/functional/move_only_function.md @@ -63,6 +63,10 @@ namespace std { | [`swap`](move_only_function/swap_free.md) | 2つの`move_only_function`オブジェクトを入れ替える | C++23 | + +## 備考 +このクラスは、フリースタンディング処理系では使用できない。 + ## 例 ### 例1: 基本の使い方 ```cpp example diff --git a/reference/functional/move_only_function/op_constructor.md b/reference/functional/move_only_function/op_constructor.md index 3ef14e738f..30c405ce04 100644 --- a/reference/functional/move_only_function/op_constructor.md +++ b/reference/functional/move_only_function/op_constructor.md @@ -67,7 +67,7 @@ explicit move_only_function(in_place_type_t, initializer_list, Args&&...); - (3) : `f`が保持する状態を`*this`に移動する。移動された後の`f`は、未規定な値を持つ有効な状態となる。 - (4) : `*this`の格納オブジェクトを - `f`が関数ポインタ型、メンバ関数ポインタ型、メンバ変数ポインタ型いずれかのヌルポインタ値の場合、値を保持しない。 - - `remove_cvref_t`が`move_only_function`の特殊化であり、かつ値を保持していない場合、値を保持しない。 + - `remove_cvref_t`が`move_only_function`または[`copyable_function`](/reference/functional/copyable_function.md)の特殊化であり、かつ値を保持していない場合、値を保持しない。 - そうでなければ、`*this`が保持する`VT`型の格納オブジェクトを、`std::forward(f)`で直接非リスト初期化する。 - (5) : `*this`が保持する`VT`型の格納オブジェクトを、`std::forward(args)...`で直接非リスト初期化する。 - (6) : `*this`が保持する`VT`型の格納オブジェクトを、`ilist, std::forward(args)...`で直接非リスト初期化する。 @@ -207,3 +207,5 @@ int main() ## 参照 - [P0288R9 move_only_function](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p0288r9.html) +- [LWG Issue 4255. `move_only_function` constructor should recognize empty `copyable_function`](https://cplusplus.github.io/LWG/issue4255) + - C++26で、空の[`copyable_function`](/reference/functional/copyable_function.md)から`move_only_function`を構築した場合も対象オブジェクトを持たない(空になる)ことが規定された。それまで`move_only_function`同士でしか空判定を引き継げなかった問題を解消するもの diff --git a/reference/hive/hive/erase_if_free.md b/reference/hive/hive/erase_if_free.md index eb9a90e675..0ea841cc6e 100644 --- a/reference/hive/hive/erase_if_free.md +++ b/reference/hive/hive/erase_if_free.md @@ -86,3 +86,5 @@ erased = 2 ## 参照 - [P0447R28 Introduction of `std::hive` to the standard library](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p0447r28.html) - C++26で`hive`が追加された +- [LWG Issue 4318. Have `hive::erase_if` reevaluate `end()` to avoid UB](https://cplusplus.github.io/LWG/issue4318) + - C++26で、効果のループが`c.end()`をキャッシュせず毎回再評価するよう修正された。`c.erase()`が終端イテレータを無効化しうるため、キャッシュした終端との比較が未定義動作を引き起こす問題を防ぐもの diff --git a/reference/initializer_list.md b/reference/initializer_list.md index 2f1dca00f1..e352e63084 100644 --- a/reference/initializer_list.md +++ b/reference/initializer_list.md @@ -5,7 +5,8 @@ ``ヘッダで提供される`initializer_list`クラスは、ユーザー定義型が初期化子リスト構文による初期化を可能にするための特別なクラスである。コンテナクラスの初期化、代入に使用される。 -本ヘッダはフリースタンディング環境でも提供される。 +## フリースタンディング +このヘッダは、フリースタンディング処理系でも使用できる。本ヘッダが提供する全ての機能がフリースタンディング処理系で使用可能である。 | 名前 | 説明 | 対応バージョン | |-----------------------------|----------------------------|-------| diff --git a/reference/inplace_vector.md b/reference/inplace_vector.md index 34901c99eb..443d205988 100644 --- a/reference/inplace_vector.md +++ b/reference/inplace_vector.md @@ -10,6 +10,9 @@ - [``](compare.md) +## フリースタンディング +このヘッダのほとんどの機能は、フリースタンディング処理系でも使用できる。ただし、例外を送出する一部の機能などは、フリースタンディング処理系では提供されない、または削除される。詳細は各機能のページを参照。 + | 名前 | 説明 | 対応バージョン | |-----------------------------|----------------------------|-------| | [`inplace_vector`](inplace_vector/inplace_vector.md) | 容量固定の可変長配列(class template) | C++26 | diff --git a/reference/inplace_vector/inplace_vector/at.md b/reference/inplace_vector/inplace_vector/at.md index 0de6a603b7..2985ce286c 100644 --- a/reference/inplace_vector/inplace_vector/at.md +++ b/reference/inplace_vector/inplace_vector/at.md @@ -21,6 +21,10 @@ constexpr const_reference at(size_type n) const; // (2) C++26 `n`番目の要素への参照を返す。 + +## 備考 +この関数は、例外を送出しうるため、フリースタンディング処理系では削除される(フリースタンディング処理系では使用できない)。 + ## 例外 `n >=` [`size()`](size.md)の場合、[`std::out_of_range`](/reference/stdexcept.md)例外を送出する。 diff --git a/reference/iterator.md b/reference/iterator.md index 86dfb11d1f..a3ebbe3c4b 100644 --- a/reference/iterator.md +++ b/reference/iterator.md @@ -23,6 +23,10 @@ C++20以降の標準ライブラリでは、任意のイテレータに対して - [``](concepts.md) (C++20) - [``](compare.md) (C++20) + +## フリースタンディング +このヘッダのほとんどの機能は、フリースタンディング処理系でも使用できる。ただし、ストリームに関連するイテレータ([`istream_iterator`](iterator/istream_iterator.md)・[`ostream_iterator`](iterator/ostream_iterator.md)・[`istreambuf_iterator`](iterator/istreambuf_iterator.md)・[`ostreambuf_iterator`](iterator/ostreambuf_iterator.md))は、フリースタンディング処理系では使用できない。 + ## イテレータコンセプト | 名前 | 説明 | 対応バージョン | diff --git a/reference/iterator/basic_const_iterator.md b/reference/iterator/basic_const_iterator.md index ef970ee8d1..980ab33125 100644 --- a/reference/iterator/basic_const_iterator.md +++ b/reference/iterator/basic_const_iterator.md @@ -42,6 +42,7 @@ namespace std { | 名前 | 説明 | 対応バージョン | |------------------------------------------------------|-------------|-------| +| `iterator_type` | 基底イテレータの型`Iterator` | C++26 | | `iterator_concept` | `Iterator`がモデルとなる最も強いイテレータコンセプトに対応する[イテレータタグ型](/reference/iterator/iterator_tag.md) | C++23 | | `iterator_category` | `Iterator`が[`forward_iterator`](/reference/iterator/forward_iterator.md)のモデルである場合にのみ[`iterator_traits`](/reference/iterator/iterator_traits.md)`::iterator_category`として定義される | C++23 | | `value_type` | [`iter_value_t`](/reference/iterator/iter_value_t.md)`` | C++23 | @@ -128,3 +129,5 @@ int main() { ## 参照 - [P2278R4 `cbegin` should always return a constant iterator](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2278r4.html) +- [LWG Issue 4253. `basic_const_iterator` should provide `iterator_type`](https://cplusplus.github.io/LWG/issue4253) + - C++26で、基底イテレータの型を取得できるよう公開メンバ型`iterator_type`(`= Iterator`)が追加された diff --git a/reference/iterator/istream_iterator.md b/reference/iterator/istream_iterator.md index 1560476bee..32463f1eed 100644 --- a/reference/iterator/istream_iterator.md +++ b/reference/iterator/istream_iterator.md @@ -56,6 +56,10 @@ namespace std { | [`operator!=`](istream_iterator/op_not_equal.md) | 非等値比較 | | + +## 備考 +このクラスは、フリースタンディング処理系では使用できない。 + ## 例 ```cpp example #include diff --git a/reference/iterator/istreambuf_iterator.md b/reference/iterator/istreambuf_iterator.md index 3bff874159..6843e94b8b 100644 --- a/reference/iterator/istreambuf_iterator.md +++ b/reference/iterator/istreambuf_iterator.md @@ -59,6 +59,10 @@ namespace std { | [`operator!=`](istreambuf_iterator/op_not_equal.md) | 非等値比較 | | + +## 備考 +このクラスは、フリースタンディング処理系では使用できない。 + ## 例 ```cpp example #include diff --git a/reference/iterator/ostream_iterator.md b/reference/iterator/ostream_iterator.md index 1891f3241a..70743ad8ce 100644 --- a/reference/iterator/ostream_iterator.md +++ b/reference/iterator/ostream_iterator.md @@ -43,6 +43,10 @@ namespace std { | `reference` | `void` | | + +## 備考 +このクラスは、フリースタンディング処理系では使用できない。 + ## 例 ```cpp example #include diff --git a/reference/iterator/ostreambuf_iterator.md b/reference/iterator/ostreambuf_iterator.md index 6670f32e2f..afa9238ed7 100644 --- a/reference/iterator/ostreambuf_iterator.md +++ b/reference/iterator/ostreambuf_iterator.md @@ -47,6 +47,10 @@ namespace std { | `reference` | `void` | | + +## 備考 +このクラスは、フリースタンディング処理系では使用できない。 + ## 例 ```cpp example #include diff --git a/reference/limits.md b/reference/limits.md index 87e20ce3aa..aa497bcfa0 100644 --- a/reference/limits.md +++ b/reference/limits.md @@ -4,7 +4,8 @@ ``ヘッダでは、算術型の実装プロパティを取得するための機能を提供する。 -本ヘッダはフリースタンディング環境でも提供される。 +## フリースタンディング +このヘッダは、フリースタンディング処理系でも使用できる。本ヘッダが提供する全ての機能がフリースタンディング処理系で使用可能である。 | 名前 | 説明 | 対応バージョン | |--------------------------------------------------------|------------------------------|-------| diff --git a/reference/linalg/hermitian_matrix_product.md b/reference/linalg/hermitian_matrix_product.md index be2d90f371..352d87510f 100644 --- a/reference/linalg/hermitian_matrix_product.md +++ b/reference/linalg/hermitian_matrix_product.md @@ -159,6 +159,7 @@ $O(\verb|A.extent(0)| \times \verb|A.extent(1)| \times \verb|B.extent(1)|)$ ## 備考 - (5), (6), (7), (8): `C`に`E`を入れても良い。 +- エルミート行列の対角成分については、[`real-if-needed`](real-if-needed.md)により実部のみが使用される。対角成分が非ゼロの虚部を持っていても、その虚部は無視される。 ## 例 @@ -359,3 +360,5 @@ int main() ## 参照 - [P1673R13 A free function linear algebra interface based on the BLAS](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p1673r13.html) - [LAPACK: {he,sy}mm: Hermitian/hermitian matrix-matrix multiply](https://netlib.org/lapack/explore-html/d0/d16/group__hemm.html) +- [LWG Issue 4136. Specify behavior of \[linalg\] Hermitian algorithms on diagonal with nonzero imaginary part](https://cplusplus.github.io/LWG/issue4136) + - C++26で、エルミート行列の対角成分が非ゼロの虚部を持つ場合に実部のみ(`real-if-needed`)が使用されることが明文化された。それまで対角成分の虚部の扱いが未規定だった問題を解消するもの diff --git a/reference/linalg/hermitian_matrix_rank_1_update.md b/reference/linalg/hermitian_matrix_rank_1_update.md index d3149a607b..830d600af3 100644 --- a/reference/linalg/hermitian_matrix_rank_1_update.md +++ b/reference/linalg/hermitian_matrix_rank_1_update.md @@ -106,6 +106,7 @@ $O((\verb|x.extent(0)|)^2)$ ## 備考 - overwriting版(1), (2)は`A`に結果を上書きする。加算更新$A = A + \alpha xx^*$を行いたい場合は、updating版(3), (4)に更新前の行列を`E`として渡す。 - エルミート性を維持するため、`alpha`は実部のみが使用される。 +- エルミート行列`A`の対角成分については、[`real-if-needed`](real-if-needed.md)により実部のみが使用される。対角成分が非ゼロの虚部を持っていても、その虚部は無視される。 ## 例 @@ -241,3 +242,5 @@ updating (3) - [LAPACK: {he,sy}r: Hermitian/symmetric rank-1 update](https://netlib.org/lapack/explore-html/dc/d82/group__her.html) - [P3371R5 Fix C++26 BLAS rank updates consistency](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3371r5.html) - C++26で、上書き(overwriting)版と更新(updating)版のオーバーロードに再構成され、BLASと整合するようになった +- [LWG Issue 4136. Specify behavior of \[linalg\] Hermitian algorithms on diagonal with nonzero imaginary part](https://cplusplus.github.io/LWG/issue4136) + - C++26で、エルミート行列の対角成分が非ゼロの虚部を持つ場合に実部のみ(`real-if-needed`)が使用されることが明文化された。それまで対角成分の虚部の扱いが未規定だった問題を解消するもの diff --git a/reference/linalg/hermitian_matrix_rank_2_update.md b/reference/linalg/hermitian_matrix_rank_2_update.md index c8588fb018..5a4e692a73 100644 --- a/reference/linalg/hermitian_matrix_rank_2_update.md +++ b/reference/linalg/hermitian_matrix_rank_2_update.md @@ -104,6 +104,8 @@ $O(\verb|x.extent(0)| \times \verb|y.extent(0)|)$ ## 備考 加算更新$A \leftarrow A + xy^* + yx^*$を行いたい場合は、更新前の行列を`E`として渡すupdating版(3), (4)を使用する。 +- エルミート行列`A`の対角成分については、[`real-if-needed`](real-if-needed.md)により実部のみが使用される。対角成分が非ゼロの虚部を持っていても、その虚部は無視される。 + ## 例 **[注意] 処理系にあるコンパイラで確認していないため、間違っているかもしれません。** @@ -239,3 +241,5 @@ int main() - [LAPACK: {he,sy}r: Hermitian/symmetric rank-2 update](https://netlib.org/lapack/explore-html/dd/de5/group__her2.html) - [P3371R5 Fix C++26 BLAS rank updates consistency](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3371r5.html) - C++26で、上書き(overwriting)版と更新(updating)版のオーバーロードに再構成され、BLASと整合するようになった +- [LWG Issue 4136. Specify behavior of \[linalg\] Hermitian algorithms on diagonal with nonzero imaginary part](https://cplusplus.github.io/LWG/issue4136) + - C++26で、エルミート行列の対角成分が非ゼロの虚部を持つ場合に実部のみ(`real-if-needed`)が使用されることが明文化された。それまで対角成分の虚部の扱いが未規定だった問題を解消するもの diff --git a/reference/linalg/hermitian_matrix_rank_2k_update.md b/reference/linalg/hermitian_matrix_rank_2k_update.md index 093cf789b6..02a4213cb0 100644 --- a/reference/linalg/hermitian_matrix_rank_2k_update.md +++ b/reference/linalg/hermitian_matrix_rank_2k_update.md @@ -77,16 +77,18 @@ namespace std::linalg { - 共通: + `Triangle`は[`upper_triangle_t`](upper_triangle_t.md)または[`lower_triangle_t`](lower_triangle_t.md) + `OutMat`が[`layout_blas_packed`](layout_blas_packed.md)を持つなら、レイアウトの`Triangle`テンプレート引数とこの関数の`Triangle`テンプレート引数が同じ型 - + [`possibly-addable`](possibly-addable.md)`()`が`true` - + [`compatible-static-extents`](compatible-static-extents.md)`(0, 1)`が`true` (つまり`A`が正方行列であること) -- (3), (4): 上記に加えて、入力行列`E`が出力行列`C`と整合する次元・レイアウトを持つこと ([`possibly-addable`](possibly-addable.md)`()`が`true`) + + [`possibly-multipliable`](possibly-multipliable.md)`()`が`true` + + [`possibly-multipliable`](possibly-multipliable.md)`()`が`true` +- (3), (4): 上記に加えて、 + + `InMat3`が[`layout_blas_packed`](layout_blas_packed.md)を持つなら、レイアウトの`Triangle`テンプレート引数とこの関数の`Triangle`テンプレート引数が同じ型 + + [`possibly-addable`](possibly-addable.md)`()`が`true` - (2), (4): [`is_execution_policy`](/reference/execution/is_execution_policy.md)`::value`が`true` ## 事前条件 -- `A.extent(0) == A.extent(1)` -- [`addable`](addable.md)`(A, B, C)`が`true` -- (3), (4): [`addable`](addable.md)`(C, E, C)`が`true` +- [`multipliable`](multipliable.md)`(A, `[`transposed`](transposed.md)`(B), C) == true` +- [`multipliable`](multipliable.md)`(B, `[`transposed`](transposed.md)`(A), C) == true` (上記と合わせて`C`が正方行列であることを含意する) +- (3), (4): [`addable`](addable.md)`(C, E, C) == true` ## 効果 @@ -99,11 +101,12 @@ namespace std::linalg { ## 計算量 -$O(\verb|A.extent(0)| \times \verb|A.extent(1)| \times \verb|C.extent(0)|)$ +$O(\verb|A.extent(0)| \times \verb|A.extent(1)| \times \verb|B.extent(0)|)$ ## 備考 - (1), (2)は出力行列`C`を上書きする。従来の加算更新 ($C \leftarrow C + AB^* + BA^*$) を行いたい場合は、updating版 (3), (4)に元の行列を`E`として渡す。 +- エルミート行列`C`の対角成分については、[`real-if-needed`](real-if-needed.md)により実部のみが使用される。対角成分が非ゼロの虚部を持っていても、その虚部は無視される。 ## 例 @@ -243,3 +246,7 @@ int main() - [LAPACK: {he,sy}r2k: Hermitian/symmetric rank-2k update](https://netlib.org/lapack/explore-html/d8/d94/group__her2k.html) - [P3371R5 Fix C++26 BLAS rank updates consistency](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3371r5.html) - C++26で、上書き(overwriting)版と更新(updating)版のオーバーロードに再構成され、BLASと整合するようになった +- [LWG Issue 4136. Specify behavior of \[linalg\] Hermitian algorithms on diagonal with nonzero imaginary part](https://cplusplus.github.io/LWG/issue4136) + - C++26で、エルミート行列の対角成分が非ゼロの虚部を持つ場合に実部のみ(`real-if-needed`)が使用されることが明文化された。それまで対角成分の虚部の扱いが未規定だった問題を解消するもの +- [LWG Issue 4137. Fix `Mandates`, `Preconditions`, and `Complexity` elements of \[linalg\] algorithms](https://cplusplus.github.io/LWG/issue4137) + - C++26で、適格要件・事前条件が2つの`possibly-multipliable`/`multipliable`を用いた形へ整理され、計算量が`A.extent(0) × A.extent(1) × B.extent(0)`へ修正された diff --git a/reference/linalg/hermitian_matrix_rank_k_update.md b/reference/linalg/hermitian_matrix_rank_k_update.md index bc557e419a..2a92713117 100644 --- a/reference/linalg/hermitian_matrix_rank_k_update.md +++ b/reference/linalg/hermitian_matrix_rank_k_update.md @@ -75,20 +75,16 @@ namespace std::linalg { - 共通: + `Triangle`は[`upper_triangle_t`](upper_triangle_t.md)または[`lower_triangle_t`](lower_triangle_t.md) + `OutMat`が[`layout_blas_packed`](layout_blas_packed.md)を持つなら、レイアウトの`Triangle`テンプレート引数とこの関数の`Triangle`テンプレート引数が同じ型 - + [`compatible-static-extents`](compatible-static-extents.md)`(0, 1)`が`true` (つまり`A`が正方行列であること) - + [`compatible-static-extents`](compatible-static-extents.md)`(0, 1)`が`true` (つまり`C`が正方行列であること) - + [`compatible-static-extents`](compatible-static-extents.md)`(0, 0)`が`true` (つまり`A`の次元と`C`の次元が同じであること) + + [`possibly-multipliable`](possibly-multipliable.md)`()`が`true` - (2), (4): [`is_execution_policy`](/reference/execution/is_execution_policy.md)`::value`が`true` -- (3), (4): 追加で、`E`が`C`と整合すること - + [`compatible-static-extents`](compatible-static-extents.md)`(0, 1)`が`true` (つまり`E`が正方行列であること) - + [`compatible-static-extents`](compatible-static-extents.md)`(0, 0)`が`true` (つまり`E`の次元と`C`の次元が同じであること) +- (3), (4): 追加で、 + + `InMat2`が[`layout_blas_packed`](layout_blas_packed.md)を持つなら、レイアウトの`Triangle`テンプレート引数とこの関数の`Triangle`テンプレート引数が同じ型 + + [`possibly-addable`](possibly-addable.md)`()`が`true` ## 事前条件 -- `A.extent(0) == A.extent(1)` -- `C.extent(0) == C.extent(1)` -- `A.extent(0) == C.extent(0)` -- (3), (4): `E.extent(0) == E.extent(1)`かつ`E.extent(0) == C.extent(0)` +- [`multipliable`](multipliable.md)`(A, `[`transposed`](transposed.md)`(A), C) == true` (これは`C`が正方行列であることを含意する) +- (3), (4): [`addable`](addable.md)`(C, E, C) == true` ## 効果 @@ -101,12 +97,13 @@ namespace std::linalg { ## 計算量 -$O(\verb|A.extent(0)| \times \verb|A.extent(1)| \times \verb|C.extent(0)|)$ +$O(\verb|A.extent(0)| \times \verb|A.extent(1)| \times \verb|A.extent(0)|)$ ## 備考 - overwriting版(1), (2)は`C`に結果を上書きする。加算更新$C = C + \alpha AA^*$を行いたい場合は、updating版(3), (4)に更新前の行列を`E`として渡す。 - エルミート性を維持するため、`alpha`は実部のみが使用される。 +- エルミート行列`C`の対角成分については、[`real-if-needed`](real-if-needed.md)により実部のみが使用される。対角成分が非ゼロの虚部を持っていても、その虚部は無視される。 ## 例 @@ -242,3 +239,7 @@ updating (3) - [LAPACK: {he,sy}rk: Hermitian/symmetric rank-k update](https://netlib.org/lapack/explore-html/d4/d6e/group__herk.html) - [P3371R5 Fix C++26 BLAS rank updates consistency](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3371r5.html) - C++26で、上書き(overwriting)版と更新(updating)版のオーバーロードに再構成され、BLASと整合するようになった +- [LWG Issue 4136. Specify behavior of \[linalg\] Hermitian algorithms on diagonal with nonzero imaginary part](https://cplusplus.github.io/LWG/issue4136) + - C++26で、エルミート行列の対角成分が非ゼロの虚部を持つ場合に実部のみ(`real-if-needed`)が使用されることが明文化された。それまで対角成分の虚部の扱いが未規定だった問題を解消するもの +- [LWG Issue 4137. Fix `Mandates`, `Preconditions`, and `Complexity` elements of \[linalg\] algorithms](https://cplusplus.github.io/LWG/issue4137) + - C++26で、適格要件・事前条件が`possibly-multipliable`/`multipliable`を用いた形へ整理され、計算量が`A.extent(0) × A.extent(1) × A.extent(0)`へ修正された diff --git a/reference/linalg/hermitian_matrix_vector_product.md b/reference/linalg/hermitian_matrix_vector_product.md index 3efbb940a8..ef34a42f81 100644 --- a/reference/linalg/hermitian_matrix_vector_product.md +++ b/reference/linalg/hermitian_matrix_vector_product.md @@ -78,7 +78,7 @@ namespace std::linalg { + `InMat`が[`layout_blas_packed`](layout_blas_packed.md)を持つなら、レイアウトの`Triangle`テンプレート引数とこの関数の`Triangle`テンプレート引数が同じ型 + [`compatible-static-extents`](compatible-static-extents.md)`(0, 1)`が`true` (つまり`A`が正方行列であること) + [`possibly-multipliable`](possibly-multipliable.md)`()`が`true` -- (3), (4): [`possibly-addable`](possibly-addable.md)`()`が`true` +- (3), (4): [`possibly-addable`](possibly-addable.md)`()`が`true` - (2), (4): [`is_execution_policy`](/reference/execution/is_execution_policy.md)`::value`が`true` @@ -86,7 +86,7 @@ namespace std::linalg { - 共通: + `A.extent(0) == A.extent(1)` + [`multipliable`](multipliable.md)`(A, x, y) == true` -- (3), (4): [`addable`](addable.md)`(x, y, z) == true` +- (3), (4): [`addable`](addable.md)`(y, y, z) == true` ## 効果 @@ -101,11 +101,12 @@ namespace std::linalg { ## 計算量 -$O(\verb|A.extent(1)|\times \verb|x.extent(0)|)$ +$O(\verb|A.extent(0)|\times \verb|x.extent(0)|)$ ## 備考 - (3), (4): `z`に`y`を入れても良い。 +- エルミート行列`A`の対角成分については、[`real-if-needed`](real-if-needed.md)により実部のみが使用される。対角成分が非ゼロの虚部を持っていても、その虚部は無視される。 ## 例 @@ -242,4 +243,8 @@ z[3] = (11,-9) ## 参照 - [P1673R13 A free function linear algebra interface based on the BLAS](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p1673r13.html) +- [LWG Issue 4136. Specify behavior of \[linalg\] Hermitian algorithms on diagonal with nonzero imaginary part](https://cplusplus.github.io/LWG/issue4136) + - C++26で、エルミート行列の対角成分が非ゼロの虚部を持つ場合に実部のみ(`real-if-needed`)が使用されることが明文化された。それまで対角成分の虚部の扱いが未規定だった問題を解消するもの +- [LWG Issue 4137. Fix `Mandates`, `Preconditions`, and `Complexity` elements of \[linalg\] algorithms](https://cplusplus.github.io/LWG/issue4137) + - C++26で、適格要件・事前条件の`possibly-addable`/`addable`の第1引数が`x`から`y`へ修正され、計算量が`A.extent(0) × x.extent(0)`へ修正された - [LAPACK: csymv](https://netlib.org/lapack/explore-html/db/d17/group__hemv_gab137e328e44dc1530ab0a93ff65c108a.html#gab137e328e44dc1530ab0a93ff65c108a) diff --git a/reference/linalg/matrix_frob_norm.md b/reference/linalg/matrix_frob_norm.md index cfe5eac2bb..dda0ac6055 100644 --- a/reference/linalg/matrix_frob_norm.md +++ b/reference/linalg/matrix_frob_norm.md @@ -37,7 +37,8 @@ namespace std::linalg { ## 適格要件 -- (1), (2): `decltype(init +` [`abs-if-needed`](abs-if-needed.md)`(declval()) * abs-if-needed(declval()))`が`Scalar`に変換可能。 +- (1), (2): `InMat::value_type`と`Scalar`が、どちらも浮動小数点数型または[`std::complex`](/reference/complex/complex.md)の特殊化であること。 +- (1), (2): `decltype(`[`abs-if-needed`](abs-if-needed.md)`(init) * abs-if-needed(init) + abs-if-needed(declval()) * abs-if-needed(declval()))`が`Scalar`に変換可能。 - (2), (4): [`is_execution_policy`](/reference/execution/is_execution_policy.md)`::value`が`true` ## 効果 @@ -59,7 +60,7 @@ $$ ## 備考 -- (1), (2): もし`InMat::value_type`と`Scalar`がどちらも浮動小数点数型または[`std::complex`](/reference/complex/complex.md)の特殊化で、`Scalar`が`InMat::value_type`より精度が高い場合、和の各項は`Scalar`またはより高い精度の型が使われる。 +- (1), (2): もし`Scalar`が`InMat::value_type`より精度が高い場合、和の各項は`Scalar`またはより高い精度の型が使われる。 ## 例 @@ -125,5 +126,7 @@ int main() ## 参照 - [P1673R13 A free function linear algebra interface based on the BLAS](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p1673r13.html) +- [LWG Issue 4315. Insufficient specification of `vector_two_norm` and `matrix_frob_norm`](https://cplusplus.github.io/LWG/issue4315) + - C++26で、「`InMat::value_type`と`Scalar`が浮動小数点数型または`complex`の特殊化であること」が適格要件に明示され、備考(Remarks)からはその条件が除かれた - [LWG Issue 4514. Missing absolute value of `init` in `vector_two_norm` and `matrix_frob_norm`](https://cplusplus.github.io/LWG/issue4514) - - C++26で、戻り値の式が`init`の二乗ではなく`init`の絶対値の二乗を用いるよう修正された。複素数(`1+i`など)や負の実数(`-1.0`など)を`init`に渡したときに不正な結果(複素数の戻り値や虚数の平方根)となる問題を防ぐもの + - C++26で、戻り値および適格要件の式が`init`の二乗ではなく`init`の絶対値の二乗を用いるよう修正された。複素数(`1+i`など)や負の実数(`-1.0`など)を`init`に渡したときに不正な結果(複素数の戻り値や虚数の平方根)となる問題を防ぐもの diff --git a/reference/linalg/matrix_vector_product.md b/reference/linalg/matrix_vector_product.md index 5de1fba238..e5c64a9a28 100644 --- a/reference/linalg/matrix_vector_product.md +++ b/reference/linalg/matrix_vector_product.md @@ -59,13 +59,13 @@ namespace std::linalg { ## 適格要件 - (1), (2), (3), (4): [`possibly-multipliable`](possibly-multipliable.md)`()`が`true` -- (3), (4): [`possibly-addable`](possibly-addable.md)`()`が`true` +- (3), (4): [`possibly-addable`](possibly-addable.md)`()`が`true` - (2), (4): [`is_execution_policy`](/reference/execution/is_execution_policy.md)`::value`が`true` ## 事前条件 - (1), (2), (3), (4): [`multipliable`](multipliable.md)`(A, x, y) == true` -- (3), (4): [`addable`](addable.md)`(x, y, z) == true` +- (3), (4): [`addable`](addable.md)`(y, y, z) == true` ## 効果 @@ -78,7 +78,7 @@ namespace std::linalg { ## 計算量 -$O(\verb|A.extent(1)|\times \verb|x.extent(0)|)$ +$O(\verb|A.extent(0)|\times \verb|x.extent(0)|)$ ## 備考 @@ -204,3 +204,5 @@ z[3] = 602 ## 参照 - [P1673R13 A free function linear algebra interface based on the BLAS](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p1673r13.html) - [LAPACK: cgemv](https://netlib.org/lapack/explore-html/d7/dda/group__gemv_ga44c85a0d7ecd60a6bc8ca27b222d7792.html#ga44c85a0d7ecd60a6bc8ca27b222d7792) +- [LWG Issue 4137. Fix `Mandates`, `Preconditions`, and `Complexity` elements of \[linalg\] algorithms](https://cplusplus.github.io/LWG/issue4137) + - C++26で、適格要件・事前条件の`possibly-addable`/`addable`の第1引数が`x`から`y`へ修正され、計算量が`A.extent(0) × x.extent(0)`へ修正された diff --git a/reference/linalg/symmetric_matrix_rank_2k_update.md b/reference/linalg/symmetric_matrix_rank_2k_update.md index 2de5a4ae9f..1dfaa57f6c 100644 --- a/reference/linalg/symmetric_matrix_rank_2k_update.md +++ b/reference/linalg/symmetric_matrix_rank_2k_update.md @@ -77,16 +77,18 @@ namespace std::linalg { - 共通: + `Triangle`は[`upper_triangle_t`](upper_triangle_t.md)または[`lower_triangle_t`](lower_triangle_t.md) + `OutMat`が[`layout_blas_packed`](layout_blas_packed.md)を持つなら、レイアウトの`Triangle`テンプレート引数とこの関数の`Triangle`テンプレート引数が同じ型 - + [`possibly-addable`](possibly-addable.md)`()`が`true` - + [`compatible-static-extents`](compatible-static-extents.md)`(0, 1)`が`true` (つまり`A`が正方行列であること) -- (3), (4): 上記に加えて、入力行列`E`が出力行列`C`と整合する次元・レイアウトを持つこと ([`possibly-addable`](possibly-addable.md)`()`が`true`) + + [`possibly-multipliable`](possibly-multipliable.md)`()`が`true` + + [`possibly-multipliable`](possibly-multipliable.md)`()`が`true` +- (3), (4): 上記に加えて、 + + `InMat3`が[`layout_blas_packed`](layout_blas_packed.md)を持つなら、レイアウトの`Triangle`テンプレート引数とこの関数の`Triangle`テンプレート引数が同じ型 + + [`possibly-addable`](possibly-addable.md)`()`が`true` - (2), (4): [`is_execution_policy`](/reference/execution/is_execution_policy.md)`::value`が`true` ## 事前条件 -- `A.extent(0) == A.extent(1)` -- [`addable`](addable.md)`(A, B, C)`が`true` -- (3), (4): [`addable`](addable.md)`(C, E, C)`が`true` +- [`multipliable`](multipliable.md)`(A, `[`transposed`](transposed.md)`(B), C) == true` +- [`multipliable`](multipliable.md)`(B, `[`transposed`](transposed.md)`(A), C) == true` (上記と合わせて`C`が正方行列であることを含意する) +- (3), (4): [`addable`](addable.md)`(C, E, C) == true` ## 効果 @@ -99,7 +101,7 @@ namespace std::linalg { ## 計算量 -$O(\verb|A.extent(0)| \times \verb|A.extent(1)| \times \verb|C.extent(0)|)$ +$O(\verb|A.extent(0)| \times \verb|A.extent(1)| \times \verb|B.extent(0)|)$ ## 備考 @@ -237,3 +239,5 @@ int main() - [LAPACK: {he,sy}r2k: Hermitian/symmetric rank-2k update](https://netlib.org/lapack/explore-html/d8/d94/group__her2k.html) - [P3371R5 Fix C++26 BLAS rank updates consistency](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3371r5.html) - C++26で、上書き(overwriting)版と更新(updating)版のオーバーロードに再構成され、BLASと整合するようになった +- [LWG Issue 4137. Fix `Mandates`, `Preconditions`, and `Complexity` elements of \[linalg\] algorithms](https://cplusplus.github.io/LWG/issue4137) + - C++26で、適格要件・事前条件が2つの`possibly-multipliable`/`multipliable`を用いた形へ整理され、計算量が`A.extent(0) × A.extent(1) × B.extent(0)`へ修正された diff --git a/reference/linalg/symmetric_matrix_rank_k_update.md b/reference/linalg/symmetric_matrix_rank_k_update.md index d03c0df07a..ee9d424224 100644 --- a/reference/linalg/symmetric_matrix_rank_k_update.md +++ b/reference/linalg/symmetric_matrix_rank_k_update.md @@ -75,20 +75,16 @@ namespace std::linalg { - 共通: + `Triangle`は[`upper_triangle_t`](upper_triangle_t.md)または[`lower_triangle_t`](lower_triangle_t.md) + `OutMat`が[`layout_blas_packed`](layout_blas_packed.md)を持つなら、レイアウトの`Triangle`テンプレート引数とこの関数の`Triangle`テンプレート引数が同じ型 - + [`compatible-static-extents`](compatible-static-extents.md)`(0, 1)`が`true` (つまり`A`が正方行列であること) - + [`compatible-static-extents`](compatible-static-extents.md)`(0, 1)`が`true` (つまり`C`が正方行列であること) - + [`compatible-static-extents`](compatible-static-extents.md)`(0, 0)`が`true` (つまり`A`の次元と`C`の次元が同じであること) + + [`possibly-multipliable`](possibly-multipliable.md)`()`が`true` - (2), (4): [`is_execution_policy`](/reference/execution/is_execution_policy.md)`::value`が`true` -- (3), (4): 追加で、`E`が`C`と整合すること - + [`compatible-static-extents`](compatible-static-extents.md)`(0, 1)`が`true` (つまり`E`が正方行列であること) - + [`compatible-static-extents`](compatible-static-extents.md)`(0, 0)`が`true` (つまり`E`の次元と`C`の次元が同じであること) +- (3), (4): 追加で、 + + `InMat2`が[`layout_blas_packed`](layout_blas_packed.md)を持つなら、レイアウトの`Triangle`テンプレート引数とこの関数の`Triangle`テンプレート引数が同じ型 + + [`possibly-addable`](possibly-addable.md)`()`が`true` ## 事前条件 -- `A.extent(0) == A.extent(1)` -- `C.extent(0) == C.extent(1)` -- `A.extent(0) == C.extent(0)` -- (3), (4): `E.extent(0) == E.extent(1)`かつ`E.extent(0) == C.extent(0)` +- [`multipliable`](multipliable.md)`(A, `[`transposed`](transposed.md)`(A), C) == true` (これは`C`が正方行列であることを含意する) +- (3), (4): [`addable`](addable.md)`(C, E, C) == true` ## 効果 @@ -101,7 +97,7 @@ namespace std::linalg { ## 計算量 -$O(\verb|A.extent(0)| \times \verb|A.extent(1)| \times \verb|C.extent(0)|)$ +$O(\verb|A.extent(0)| \times \verb|A.extent(1)| \times \verb|A.extent(0)|)$ ## 備考 @@ -235,3 +231,5 @@ updating (3) - [LAPACK: {he,sy}rk: Hermitian/symmetric rank-k update](https://netlib.org/lapack/explore-html/d4/d6e/group__herk.html) - [P3371R5 Fix C++26 BLAS rank updates consistency](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3371r5.html) - C++26で、上書き(overwriting)版と更新(updating)版のオーバーロードに再構成され、BLASと整合するようになった +- [LWG Issue 4137. Fix `Mandates`, `Preconditions`, and `Complexity` elements of \[linalg\] algorithms](https://cplusplus.github.io/LWG/issue4137) + - C++26で、適格要件・事前条件が`possibly-multipliable`/`multipliable`を用いた形へ整理され、計算量が`A.extent(0) × A.extent(1) × A.extent(0)`へ修正された diff --git a/reference/linalg/symmetric_matrix_vector_product.md b/reference/linalg/symmetric_matrix_vector_product.md index 0d6f334f2d..40a7804925 100644 --- a/reference/linalg/symmetric_matrix_vector_product.md +++ b/reference/linalg/symmetric_matrix_vector_product.md @@ -74,14 +74,14 @@ namespace std::linalg { + `InMat`が[`layout_blas_packed`](layout_blas_packed.md)を持つなら、レイアウトの`Triangle`テンプレート引数とこの関数の`Triangle`テンプレート引数が同じ型 + [`compatible-static-extents`](compatible-static-extents.md)`(0, 1)`が`true` (つまり`A`が正方行列であること) + [`possibly-multipliable`](possibly-multipliable.md)`()`が`true` -- (3), (4): [`possibly-addable`](possibly-addable.md)`()`が`true` +- (3), (4): [`possibly-addable`](possibly-addable.md)`()`が`true` - (2), (4): [`is_execution_policy`](/reference/execution/is_execution_policy.md)`::value`が`true` ## 事前条件 - (1), (2), (3), (4): `A.extent(0) == A.extent(1)` - (1), (2), (3), (4): [`multipliable`](multipliable.md)`(A, x, y) == true` -- (3), (4): [`addable`](addable.md)`(x, y, z) == true` +- (3), (4): [`addable`](addable.md)`(y, y, z) == true` ## 効果 @@ -96,7 +96,7 @@ namespace std::linalg { ## 計算量 -$O(\verb|A.extent(1)|\times \verb|x.extent(0)|)$ +$O(\verb|A.extent(0)|\times \verb|x.extent(0)|)$ ## 備考 @@ -233,4 +233,6 @@ z[3] = 71 ## 参照 - [P1673R13 A free function linear algebra interface based on the BLAS](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p1673r13.html) +- [LWG Issue 4137. Fix `Mandates`, `Preconditions`, and `Complexity` elements of \[linalg\] algorithms](https://cplusplus.github.io/LWG/issue4137) + - C++26で、適格要件・事前条件の`possibly-addable`/`addable`の第1引数が`x`から`y`へ修正され、計算量が`A.extent(0) × x.extent(0)`へ修正された - [LAPACK: csymv](https://netlib.org/lapack/explore-html/db/d17/group__hemv_gab137e328e44dc1530ab0a93ff65c108a.html#gab137e328e44dc1530ab0a93ff65c108a) diff --git a/reference/linalg/triangular_matrix_matrix_left_solve.md b/reference/linalg/triangular_matrix_matrix_left_solve.md index a2102eb520..ecc6423ff4 100644 --- a/reference/linalg/triangular_matrix_matrix_left_solve.md +++ b/reference/linalg/triangular_matrix_matrix_left_solve.md @@ -166,7 +166,8 @@ namespace std::linalg { ## 計算量 -$O((\verb|A.extent(0)|)^2 \times \verb|B.extent(1)|)$ +- (1), (2), (3), (4): $O(\verb|A.extent(0)| \times \verb|B.extent(1)| \times \verb|B.extent(1)|)$ +- (5), (6), (7), (8): $O(\verb|B.extent(0)| \times \verb|A.extent(0)| \times \verb|A.extent(1)|)$ ## 備考 @@ -384,3 +385,5 @@ int main() ## 参照 - [P1673R13 A free function linear algebra interface based on the BLAS](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p1673r13.html) - [LAPACK: trsm](https://netlib.org/lapack/explore-html/d9/de5/group__trsm.html) +- [LWG Issue 4137. Fix `Mandates`, `Preconditions`, and `Complexity` elements of \[linalg\] algorithms](https://cplusplus.github.io/LWG/issue4137) + - C++26で、計算量が入力のみに依存する形へ修正された ((1)〜(4)は`A.extent(0) × B.extent(1) × B.extent(1)`、(5)〜(8)は`B.extent(0) × A.extent(0) × A.extent(1)`) diff --git a/reference/linalg/triangular_matrix_matrix_right_solve.md b/reference/linalg/triangular_matrix_matrix_right_solve.md index 27a1aacecd..c9ea4d10b1 100644 --- a/reference/linalg/triangular_matrix_matrix_right_solve.md +++ b/reference/linalg/triangular_matrix_matrix_right_solve.md @@ -166,7 +166,8 @@ namespace std::linalg { ## 計算量 -$O((\verb|A.extent(0)|)^2 \times \verb|B.extent(0)|)$ +- (1), (2), (3), (4): $O(\verb|B.extent(0)| \times \verb|B.extent(1)| \times \verb|A.extent(1)|)$ +- (5), (6), (7), (8): $O(\verb|A.extent(0)| \times \verb|A.extent(1)| \times \verb|B.extent(1)|)$ ## 備考 diff --git a/reference/linalg/triangular_matrix_vector_product.md b/reference/linalg/triangular_matrix_vector_product.md index f490da819c..dd3969d7a8 100644 --- a/reference/linalg/triangular_matrix_vector_product.md +++ b/reference/linalg/triangular_matrix_vector_product.md @@ -134,7 +134,8 @@ namespace std::linalg { ## 計算量 -$O(\verb|A.extent(1)|\times \verb|x.extent(0)|)$ +- (1), (2), (5), (6): $O(\verb|A.extent(0)|\times \verb|x.extent(0)|)$ +- (3), (4): $O(\verb|A.extent(0)|\times \verb|y.extent(0)|)$ ## 備考 @@ -334,4 +335,6 @@ z[3] = 6 ## 参照 - [P1673R13 A free function linear algebra interface based on the BLAS](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p1673r13.html) +- [LWG Issue 4137. Fix `Mandates`, `Preconditions`, and `Complexity` elements of \[linalg\] algorithms](https://cplusplus.github.io/LWG/issue4137) + - C++26で、計算量が`A.extent(0)`を用いる形へ修正された ((1), (2), (5), (6)は`A.extent(0) × x.extent(0)`、(3), (4)は`A.extent(0) × y.extent(0)`) - [LAPACK: ctrmv](https://netlib.org/lapack/explore-html/d6/d1c/group__trmv_ga0adaf80ae1dfe117390bd7030fd865f1.html#ga0adaf80ae1dfe117390bd7030fd865f1) diff --git a/reference/linalg/vector_two_norm.md b/reference/linalg/vector_two_norm.md index 9b4acbb6c2..486343ed21 100644 --- a/reference/linalg/vector_two_norm.md +++ b/reference/linalg/vector_two_norm.md @@ -36,7 +36,8 @@ namespace std::linalg { ## 適格要件 -- (1), (2): `decltype(init +` [`abs-if-needed`](abs-if-needed.md)`(declval()) * abs-if-needed(declval()))`が`Scalar`に変換可能。 +- (1), (2): `InVec::value_type`と`Scalar`が、どちらも浮動小数点数型または[`std::complex`](/reference/complex/complex.md)の特殊化であること。 +- (1), (2): `decltype(`[`abs-if-needed`](abs-if-needed.md)`(init) * abs-if-needed(init) + abs-if-needed(declval()) * abs-if-needed(declval()))`が`Scalar`に変換可能。 - (2), (4): [`is_execution_policy`](/reference/execution/is_execution_policy.md)`::value`が`true` @@ -60,7 +61,7 @@ $$ ## 備考 -- (1), (2): もし`InVec::value_type`と`Scalar`がどちらも浮動小数点数型または[`std::complex`](/reference/complex/complex.md)の特殊化で、`Scalar`が`InVec::value_type`より精度が高い場合、和の各項は`Scalar`またはより高い精度の型が使われる。 +- (1), (2): もし`Scalar`が`InVec::value_type`より精度が高い場合、和の各項は`Scalar`またはより高い精度の型が使われる。 ## 例 @@ -124,5 +125,7 @@ int main() ## 参照 - [P1673R13 A free function linear algebra interface based on the BLAS](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p1673r13.html) - [LAPACK: dnrm2](https://netlib.org/lapack/explore-html/d1/d2a/group__nrm2_gab5393665c8f0e7d5de9bd1dd2ff0d9d0.html#gab5393665c8f0e7d5de9bd1dd2ff0d9d0) +- [LWG Issue 4315. Insufficient specification of `vector_two_norm` and `matrix_frob_norm`](https://cplusplus.github.io/LWG/issue4315) + - C++26で、「`InVec::value_type`と`Scalar`が浮動小数点数型または`complex`の特殊化であること」が適格要件に明示され、備考(Remarks)からはその条件が除かれた - [LWG Issue 4514. Missing absolute value of `init` in `vector_two_norm` and `matrix_frob_norm`](https://cplusplus.github.io/LWG/issue4514) - - C++26で、戻り値の式が`init`の二乗ではなく`init`の絶対値の二乗を用いるよう修正された。複素数(`1+i`など)や負の実数(`-1.0`など)を`init`に渡したときに不正な結果(複素数の戻り値や虚数の平方根)となる問題を防ぐもの + - C++26で、戻り値および適格要件の式が`init`の二乗ではなく`init`の絶対値の二乗を用いるよう修正された。複素数(`1+i`など)や負の実数(`-1.0`など)を`init`に渡したときに不正な結果(複素数の戻り値や虚数の平方根)となる問題を防ぐもの diff --git a/reference/map/map/op_constructor.md b/reference/map/map/op_constructor.md index 30c80e02eb..3b3eae0b9e 100644 --- a/reference/map/map/op_constructor.md +++ b/reference/map/map/op_constructor.md @@ -217,3 +217,6 @@ Size of m2: 2 - [P1518R2 Stop Overconstraining Allocators in Container Deduction Guides](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p1518r2.html) - C++23でのアロケータ引数を`type_identity_t`で包む変更 - [P3372R3 constexpr containers and adaptors](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3372r3.html) + - C++26で`map`のメンバが`constexpr`対応した +- [LWG Issue 4291. `explicit map(const Allocator&)` should be constexpr](https://cplusplus.github.io/LWG/issue4291) + - C++26で、他のコンストラクタと同様に(3) `explicit map(const Allocator&)`にも`constexpr`が追加された(P3372で付け忘れられていたものの修正) diff --git a/reference/mdspan.md b/reference/mdspan.md index f8d0195bda..18bbd8c7e6 100644 --- a/reference/mdspan.md +++ b/reference/mdspan.md @@ -5,6 +5,9 @@ ``ヘッダでは、任意のメモリブロックに対して多次元配列のようにアクセスする機能を定義する。 +## フリースタンディング +このヘッダのほとんどの機能は、フリースタンディング処理系でも使用できる。ただし、例外を送出する一部の機能などは、フリースタンディング処理系では提供されない、または削除される。詳細は各機能のページを参照。 + ## 多次元配列サイズ | 名前 | 説明 | 対応バージョン | @@ -12,6 +15,7 @@ | [`extents`](mdspan/extents.md) | 多次元配列のサイズを表す値 (class template) | C++23 | | [`dextents`](mdspan/extents.md) | 全次元が動的な多次元配列のサイズを表す値 (alias template) | C++23 | | [`dims`](mdspan/extents.md) | 全次元が動的な多次元配列のサイズを表す値 (alias template) | C++26 | +| [`dynamic_extent`](span/dynamic_extent.md) | 動的な要素数をもつことを指示する定数 (variable) | C++26 | ## レイアウトマッピング @@ -49,7 +53,7 @@ | [`full_extent`](mdspan/full_extent_t.md) | 指定次元の全要素取り出しを指示するタグ値 (variable) | C++26 | | [`submdspan_mapping_result`](mdspan/submdspan_mapping_result.md) | 多次元配列部分ビューのレイアウトマッピング情報 (class template) | C++26 | | [`subextents`](mdspan/subextents.md) | 多次元配列部分ビューの多次元配列サイズを計算する (function template) | C++26 | -| [`canonical_slices`](mdspan/canonical_slices.md) | 多次元配列部分ビュー取得時の多次元インデクスを正規化する (function template) | C++26 | +| [`canonical_slices`](mdspan/canonical_slices.md) | 多次元配列部分ビュー取得時の多次元インデックスを正規化する (function template) | C++26 | | [`submdspan`](mdspan/submdspan.md) | 多次元配列部分ビューを取得する (function template) | C++26 | @@ -69,3 +73,5 @@ - [P2642R6 Padded mdspan layouts](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2642r6.pdf) - [P2897R7 `aligned_accessor`: An mdspan accessor expressing pointer over-alignment](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2897r7.html) - [P3663R3 Future-proof `submdspan_mapping`](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3663r3.html) +- [LWG Issue 4275. `std::dynamic_extent` should also be defined in ``](https://cplusplus.github.io/LWG/issue4275) + - C++26で、``で定義される[`dynamic_extent`](span/dynamic_extent.md)が``のインクルードによっても利用可能になった diff --git a/reference/mdspan/extents/index-cast.md b/reference/mdspan/extents/index-cast.md index 7ae05cdba8..13cc42827c 100644 --- a/reference/mdspan/extents/index-cast.md +++ b/reference/mdspan/extents/index-cast.md @@ -15,9 +15,9 @@ static constexpr auto index-cast(OtherIndexType&& i) noexcept; // 説明専用 多次元配列のインデクス型へと変換する、説明専用のメンバ関数である。 -## 戻り値 -- `OtherIndexType`が`bool`型以外の整数型の場合、`return i;`と等価。 -- `OtherIndexType`が`bool`型の場合、`return static_cast(i);`と等価。 +## 効果 +- [`remove_cvref_t`](/reference/type_traits/remove_cvref.md)``が`bool`型以外の整数型の場合、`return i;`と等価。 +- そうでない場合、`return static_cast(i);`と等価。 ## 例外 @@ -31,3 +31,5 @@ static constexpr auto index-cast(OtherIndexType&& i) noexcept; // 説明専用 ## 参照 - [P0009R18 MDSPAN](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p0009r18.html) +- [LWG Issue 4020. `extents::index-cast` weirdness](https://cplusplus.github.io/LWG/issue4020) + - C++26で、効果の条件が`OtherIndexType`から[`remove_cvref_t`](/reference/type_traits/remove_cvref.md)``に修正された。`OtherIndexType`は転送参照から推論されるため参照型になりえ、そのままでは整数型の左辺値が`static_cast`側の分岐に落ちてしまう問題を防ぐもの diff --git a/reference/mdspan/layout_left_padded/mapping.md b/reference/mdspan/layout_left_padded/mapping.md index d78a0ac3be..474bded4c7 100644 --- a/reference/mdspan/layout_left_padded/mapping.md +++ b/reference/mdspan/layout_left_padded/mapping.md @@ -45,7 +45,7 @@ namespace std { ## 適格要件 - `Extents`は[`extents`](../extents.md)の特殊化であること。 - `rank_dynamic() == 0`のとき、多次元インデクス空間`Extents()`のサイズが`index_type`型で表現できること。 -- 値`padding_value`が`index_type`型で表現できること。 +- `padding_value !=` [`dynamic_extent`](/reference/span/dynamic_extent.md)のとき、値`padding_value`が`index_type`型で表現できること。 - 以下を満たすとき、`LEAST-MULTIPLE-AT-LEAST(padding_value, first-static-extent)`が、`size_t`型および`index_type`型で表現できること。 - `rank_ > 1`、かつ - `padding_value !=` [`dynamic_extent`](/reference/span/dynamic_extent.md)、かつ @@ -131,3 +131,5 @@ namespace std { ## 参照 - [P2642R6 Padded mdspan layouts](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2642r6.pdf) +- [LWG Issue 4372. Weaken `Mandates:` for dynamic padding values in padded layouts](https://cplusplus.github.io/LWG/issue4372) + - C++26で、「`padding_value`が`index_type`型で表現可能であること」という適格要件が、`padding_value`が`dynamic_extent`に等しくない場合に限り適用されるよう緩和された(動的なパディング値を指定する場合にこの制約が不要なため) diff --git a/reference/mdspan/layout_right_padded/mapping.md b/reference/mdspan/layout_right_padded/mapping.md index d71ae32151..dde60ce03f 100644 --- a/reference/mdspan/layout_right_padded/mapping.md +++ b/reference/mdspan/layout_right_padded/mapping.md @@ -45,7 +45,7 @@ namespace std { ## 適格要件 - `Extents`は[`extents`](../extents.md)の特殊化であること。 - `rank_dynamic() == 0`のとき、多次元インデクス空間`Extents()`のサイズが`index_type`型で表現できること。 -- 値`padding_value`が`index_type`型で表現できること。 +- `padding_value !=` [`dynamic_extent`](/reference/span/dynamic_extent.md)のとき、値`padding_value`が`index_type`型で表現できること。 - 以下を満たすとき、`LEAST-MULTIPLE-AT-LEAST(padding_value, last-static-extent)`が、`size_t`型および`index_type`型で表現できること。 - `rank_ > 1`、かつ - `padding_value !=` [`dynamic_extent`](/reference/span/dynamic_extent.md)、かつ @@ -131,3 +131,5 @@ namespace std { ## 参照 - [P2642R6 Padded mdspan layouts](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2642r6.pdf) +- [LWG Issue 4372. Weaken `Mandates:` for dynamic padding values in padded layouts](https://cplusplus.github.io/LWG/issue4372) + - C++26で、「`padding_value`が`index_type`型で表現可能であること」という適格要件が、`padding_value`が`dynamic_extent`に等しくない場合に限り適用されるよう緩和された(動的なパディング値を指定する場合にこの制約が不要なため) diff --git a/reference/mdspan/layout_stride/mapping.md b/reference/mdspan/layout_stride/mapping.md index 0f5258252a..53269f74f8 100644 --- a/reference/mdspan/layout_stride/mapping.md +++ b/reference/mdspan/layout_stride/mapping.md @@ -32,7 +32,7 @@ namespace std { ## 適格要件 - `Extents`は[`extents`](../extents.md)の特殊化であること。 -- [`Extents::rank_dynamic()`](../extents/rank_dynamic.md) `== 0`が`true`のとき、多次元インデクス空間`Extents()`のサイズが`Extents::index_type`型で表現できること。 +- [`Extents::rank_dynamic()`](../extents/rank_dynamic.md) `== 0`が`true`のとき、多次元インデックス空間`Extents()`のサイズが`Extents::index_type`型で表現できること。 ## メンバ関数 @@ -51,7 +51,7 @@ namespace std { | `extents` | 多次元配列のサイズ`extents_`を取得する | C++23 | | `strides` | ストライド配列`strides_`を取得する | C++23 | | [`required_span_size`](mapping/required_span_size.md) | 要素アクセス範囲を取得する | C++23 | -| [`operator()`](mapping/op_call.md) | 多次元配列インデクスから要素位置へ変換する | C++23 | +| [`operator()`](mapping/op_call.md) | 多次元配列インデックスから要素位置へ変換する | C++23 | | [`is_exhaustive`](mapping/is_exhaustive.md) | [Exhaustive特性](../LayoutMapping.md)を取得する | C++23 | | [`stride`](mapping/stride.md) | 指定次元のストライド幅を取得する | C++23 | @@ -61,7 +61,7 @@ namespace std { | 名前 | 説明 | 対応バージョン | |------|------|----------------| | `is_always_unique` | `true`を返す | C++23 | -| `is_always_exhaustive` | `false`を返す | C++23 | +| `is_always_exhaustive` | `rank() == 0`、または静的要素数が`0`の次元が存在すれば`true`、そうでなければ`false`を返す(C++23では常に`false`、C++26で変更) | C++23 | | `is_always_strided` | `true`を返す | C++23 | | `is_unique` | `true`を返す | C++23 | | `is_strided` | `true`を返す | C++23 | @@ -144,3 +144,5 @@ int main() ## 参照 - [P0009R18 MDSPAN](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p0009r18.html) - [P2630R4 Submdspan](https://open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2630r4.html) +- [LWG Issue 4266. `layout_stride::mapping` should treat empty mappings as exhaustive](https://cplusplus.github.io/LWG/issue4266) + - C++26で、`is_always_exhaustive()`が`rank() == 0`や静的要素数`0`の次元を持つ場合に`true`を返すよう変更された(C++23では常に`false`)。あわせて[`is_exhaustive()`](mapping/is_exhaustive.md)も多次元インデックス空間が空の場合に`true`を返すよう拡張された diff --git a/reference/mdspan/layout_stride/mapping/is_exhaustive.md b/reference/mdspan/layout_stride/mapping/is_exhaustive.md index f0a7e81476..9f4b289c21 100644 --- a/reference/mdspan/layout_stride/mapping/is_exhaustive.md +++ b/reference/mdspan/layout_stride/mapping/is_exhaustive.md @@ -14,8 +14,10 @@ constexpr bool is_exhaustive() const noexcept; ## 戻り値 -- `rank_ == 0`のとき、`true`を返す。 -- そうでなければ、取りうる全ての多次元インデクス値に対応する要素位置を考えたとき、アクセスされうる要素位置に隙間が生じないならば`true`を返す。 +- 次のいずれかのとき、`true`を返す。 + - `rank_ == 0`である + - C++26 : 多次元インデックス空間`extents()`のサイズが`0`である +- そうでなければ、取りうる全ての多次元インデックス値に対応する要素位置を考えたとき、アクセスされうる要素位置に隙間が生じないならば`true`を返す。 - そうでなければ、`false`を返す。 @@ -62,3 +64,5 @@ int main() ## 参照 - [P0009R18 MDSPAN](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p0009r18.html) +- [LWG Issue 4266. `layout_stride::mapping` should treat empty mappings as exhaustive](https://cplusplus.github.io/LWG/issue4266) + - C++26で、多次元インデックス空間が空(サイズが`0`)の場合も`true`を返すよう戻り値の条件が拡張された。あわせて`is_always_exhaustive()`も`rank() == 0`や静的要素数`0`の次元を持つ場合に`true`を返すよう変更された diff --git a/reference/memory.md b/reference/memory.md index 70a9b871d5..20500581fa 100644 --- a/reference/memory.md +++ b/reference/memory.md @@ -8,6 +8,9 @@ - [``](compare.md) (C++20) +## フリースタンディング +このヘッダのほとんどの機能は、フリースタンディング処理系でも使用できる。ただし、実行ポリシーを取る並列アルゴリズムのオーバーロードは、フリースタンディング処理系では削除される。 + ## メモリアロケータ | 名前 | 説明 | 対応バージョン | diff --git a/reference/memory/is_sufficiently_aligned.md b/reference/memory/is_sufficiently_aligned.md index d74ff1c107..a56f2c5e62 100644 --- a/reference/memory/is_sufficiently_aligned.md +++ b/reference/memory/is_sufficiently_aligned.md @@ -31,6 +31,10 @@ namespace std { 投げない +## 備考 +この関数は、フリースタンディング処理系でも使用できる。 + + ## この機能が必要になった背景・経緯 この関数テンプレートは[``](/reference/mdspan.md)ヘッダへの[`aligned_accessor`](/reference/mdspan/aligned_accessor.md)導入に伴って必要とされた機能である。 一方で、ポインタ値のアライメント要件を検査するユースケースは一般的と考えられたため、汎用ユーティリティとして``ヘッダに対して機能追加された。 @@ -86,5 +90,7 @@ bool is_sufficiently_aligned(ElementType* p) ## 参照 - [P2897R7 `aligned_accessor`: An mdspan accessor expressing pointer over-alignment](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2897r7.html) +- [LWG Issue 4286. Some more feature-test macros for fully freestanding features are not marked freestanding](https://cplusplus.github.io/LWG/issue4286) + - C++26で、この関数がフリースタンディング処理系でも使用できる(フリースタンディング機能である)ことが明示された - [LWG Issue 4290. Missing Mandates clauses on `is_sufficiently_aligned`](https://cplusplus.github.io/LWG/issue4290) - C++26で、`Alignment`が2の累乗であることの適格要件が追加された diff --git a/reference/meta.md b/reference/meta.md index db957a1965..5d76772f93 100644 --- a/reference/meta.md +++ b/reference/meta.md @@ -6,6 +6,11 @@ このヘッダのすべての関数は`consteval`であり、コンパイル時にのみ使用できる。 +このヘッダでは、以下の標準ヘッダをインクルードする: + +- [``](compare.md) +- [``](initializer_list.md) + ## リフレクション型 @@ -444,4 +449,6 @@ - [P3920R0 Wording for NB comment resolution on trivial relocation](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3920r0.html) - C++26策定中に、trivially relocatable関係が一旦削除された - [LWG Issue 4555. Remove `is_consteval_only`](https://cplusplus.github.io/LWG/issue4555) - - C++26で入る予定だった`is_consteval_only_type`の追加が取り消された \ No newline at end of file + - C++26で入る予定だった`is_consteval_only_type`の追加が取り消された +- [LWG Issue 4416. `` should include ``](https://cplusplus.github.io/LWG/issue4416) + - C++26で、``ヘッダが``をインクルードするよう修正された。[`std::meta::type_order`](meta/type_order.md)などが`strong_ordering`を返すため \ No newline at end of file diff --git a/reference/meta/data_member_spec.md b/reference/meta/data_member_spec.md index 90208a258f..1da7c510e8 100644 --- a/reference/meta/data_member_spec.md +++ b/reference/meta/data_member_spec.md @@ -79,5 +79,7 @@ int main() { ## 参照 - [P2996R13 Reflection for C++26](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p2996r13.html) +- [LWG Issue 4423. `meta::data_member_spec` allows negative bit-field widths](https://cplusplus.github.io/LWG/issue4423) + - C++26で、`options.bit_width`の値`V`が負でないことが例外送出条件に追加された。負のビット幅を指定できてしまう問題を防ぐもの - [LWG Issue 4517. `data_member_spec` should throw for cv-qualified unnamed bit-fields](https://cplusplus.github.io/LWG/issue4517) - C++26で、無名ビットフィールド(`options.name`に値がない)に対して`type`がCV修飾されている場合に例外を送出することが規定された。CV修飾された型の無名ビットフィールドを禁止する言語側の規則(CWG 2229)と整合させるもの diff --git a/reference/new.md b/reference/new.md index 67e2929cdc..b5667050da 100644 --- a/reference/new.md +++ b/reference/new.md @@ -3,7 +3,8 @@ ``ヘッダは、プログラムが動的に記憶域を確保し、管理するための機能を定義し、記憶域の管理のエラー報告(例外の送出)についても定義する。このヘッダはグローバルネームスペースの`new`演算子および`delete`演算子をオーバーロードする。placement new を行いたい場合などに用いる。 -本ヘッダはフリースタンディング環境でも提供される。 +## フリースタンディング +このヘッダは、フリースタンディング処理系でも使用できる。本ヘッダが提供する全ての機能がフリースタンディング処理系で使用可能である。 ## 型 diff --git a/reference/numeric.md b/reference/numeric.md index bd3cd2b742..563d8b1909 100644 --- a/reference/numeric.md +++ b/reference/numeric.md @@ -4,6 +4,9 @@ `` ヘッダでは、数値のシーケンスや数値の処理に特化したアルゴリズムを定義する。 +## フリースタンディング +このヘッダのほとんどの機能は、フリースタンディング処理系でも使用できる。ただし、実行ポリシーを取る並列アルゴリズムのオーバーロードは、フリースタンディング処理系では削除される。 + ## 集計 | 名前 | 説明 | 対応バージョン | diff --git a/reference/numeric/midpoint.md b/reference/numeric/midpoint.md index a4501acce3..b7a9897d0e 100644 --- a/reference/numeric/midpoint.md +++ b/reference/numeric/midpoint.md @@ -24,7 +24,7 @@ namespace std { ## テンプレートパラメータ制約 -- (1) : 型`T` が `bool` 以外の[算術型](/reference/type_traits/is_arithmetic.md)であること +- (1) : 型`T` が[算術型](/reference/type_traits/is_arithmetic.md)であり、かつCV修飾を除いた型が`bool`でないこと - (2) : 型`T`はオブジェクト型であること @@ -162,3 +162,5 @@ int main() ## 参照 - [P0811R3 Well-behaved interpolation for numbers and pointers](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p0811r3.html) - [LWG Issue 3200. `midpoint` should not constrain `T` is complete](https://cplusplus.github.io/LWG/lwg-active.html#3200) +- [LWG Issue 4265. `std::midpoint` should not accept `const bool`](https://cplusplus.github.io/LWG/issue4265) + - (1)のテンプレートパラメータ制約が、`bool`だけでなくCV修飾された`bool`(`const bool`など)も除外するよう明確化された。この仕様はC++26で規定されたが、仕様の欠陥修正であり主要な実装は早期に対応している diff --git a/reference/optional.md b/reference/optional.md index 20506eea3b..613459a331 100644 --- a/reference/optional.md +++ b/reference/optional.md @@ -9,6 +9,10 @@ - [``](compare.md) (C++20) +## フリースタンディング +このヘッダのほとんどの機能は、フリースタンディング処理系でも使用できる。ただし、[`optional::value()`](optional/optional/value.md)メンバ関数は、値を保持していないときに例外を送出するため、フリースタンディング処理系では削除される。 + + | 名前 | 説明 | 対応バージョン | |---------------------------------------|------------------------|-------| | [`optional`](optional/optional.md) | 任意で値を持たせられるオブジェクト (class template) | C++17 | diff --git a/reference/optional/make_optional.md b/reference/optional/make_optional.md index cfbbd09761..c43e2d12d5 100644 --- a/reference/optional/make_optional.md +++ b/reference/optional/make_optional.md @@ -28,7 +28,7 @@ namespace std { ## 効果 -- (1) : `return optional<`[`decay_t`](/reference/type_traits/decay.md)`>(`[`std::forward`](/reference/utility/forward.md)`(v))` +- (1) : `return optional<`[`decay_t`](/reference/type_traits/decay.md)`>(`[`std::forward`](/reference/utility/forward.md)`(v));` と等価の処理を行う - (2) : `return optional(`[`in_place`](/reference/utility/in_place_t.md)`,` [`std::forward`](/reference/utility/forward.md)`(args)...);` と等価の処理を行う - (3) `return optional(`[`in_place`](/reference/utility/in_place_t.md)`, il,` [`std::forward`](/reference/utility/forward.md)`(args)...);` と等価の処理を行う @@ -85,3 +85,8 @@ int main() - [GCC](/implementation.md#gcc): 7.2 [mark verified] - [ICC](/implementation.md#icc): ?? - [Visual C++](/implementation.md#visual_cpp): ?? + + +## 参照 +- [LWG Issue 3627. Inconsistent specifications for `std::make_optional` overloads](https://cplusplus.github.io/LWG/issue3627) + - C++26で、(1)の仕様が「戻り値(Returns)」から他のオーバーロードと同じ「効果(Effects): 〜と等価」の形式へ変更された(意味は変わらない編集上の整合化) diff --git a/reference/optional/optional/emplace.md b/reference/optional/optional/emplace.md index 6ee72b9359..c5841510a2 100644 --- a/reference/optional/optional/emplace.md +++ b/reference/optional/optional/emplace.md @@ -128,3 +128,5 @@ int main() - C++26で参照型`T&`に対する部分特殊化を追加 - [LWG Issue 2746. Inconsistency between requirements for `emplace` between `optional` and `variant`](https://cplusplus.github.io/LWG/issue2746) - C++26で、`emplace`の制約が`Requires`(ハードエラー)から`Constraints`(SFINAE)に統一された(cpprefjpでは「テンプレートパラメータ制約」として記載済み) +- [LWG Issue 4300. Missing `Returns:` element in `optional::emplace`](https://cplusplus.github.io/LWG/issue4300) + - C++26で、`optional`版 (3) の戻り値が`*val`(参照先)であることが明記された(cpprefjpの戻り値記述は全オーバーロード共通で既にこれを含む) diff --git a/reference/optional/optional/op_equal.md b/reference/optional/optional/op_equal.md index c8161b828c..020cfbf30b 100644 --- a/reference/optional/optional/op_equal.md +++ b/reference/optional/optional/op_equal.md @@ -116,3 +116,5 @@ int main() - C++20での三方比較演算子の追加と、関連する演算子の自動導出 - [P2944R3 Comparisons for `reference_wrapper`](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2944r3.html) - C++26でテンプレートパラメータ制約が整理された +- [LWG Issue 4370. Comparison of `optional` to `T` may be ill-formed](https://cplusplus.github.io/LWG/issue4370) + - C++26で、効果が三項演算子形式(`x.has_value() ? *x == v : false`)から`if`文形式へ変更された。比較結果が`bool`以外の型を返す場合に三項演算子で共通型が得られず不適格となる問題を防ぐもの(cpprefjpの戻り値の記述はもともとこの意味を表している) diff --git a/reference/optional/optional/op_greater.md b/reference/optional/optional/op_greater.md index 13bfe1ae2d..7e612e2c55 100644 --- a/reference/optional/optional/op_greater.md +++ b/reference/optional/optional/op_greater.md @@ -104,3 +104,5 @@ int main() - [LWG Issue 2934. `optional` doesn't compare with `T`](https://wg21.cmeerw.net/lwg/issue2934) - [P1614R2 The Mothership has Landed](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1614r2.html) - C++20での三方比較演算子の追加と、関連する演算子の自動導出 +- [LWG Issue 4370. Comparison of `optional` to `T` may be ill-formed](https://cplusplus.github.io/LWG/issue4370) + - C++26で、効果が三項演算子形式(`x.has_value() ? *x == v : false`)から`if`文形式へ変更された。比較結果が`bool`以外の型を返す場合に三項演算子で共通型が得られず不適格となる問題を防ぐもの(cpprefjpの戻り値の記述はもともとこの意味を表している) diff --git a/reference/optional/optional/op_greater_equal.md b/reference/optional/optional/op_greater_equal.md index 4b2d6504cd..fba7a7ee8a 100644 --- a/reference/optional/optional/op_greater_equal.md +++ b/reference/optional/optional/op_greater_equal.md @@ -104,3 +104,5 @@ int main() - [LWG Issue 2934. `optional` doesn't compare with `T`](https://wg21.cmeerw.net/lwg/issue2934) - [P1614R2 The Mothership has Landed](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1614r2.html) - C++20での三方比較演算子の追加と、関連する演算子の自動導出 +- [LWG Issue 4370. Comparison of `optional` to `T` may be ill-formed](https://cplusplus.github.io/LWG/issue4370) + - C++26で、効果が三項演算子形式(`x.has_value() ? *x == v : false`)から`if`文形式へ変更された。比較結果が`bool`以外の型を返す場合に三項演算子で共通型が得られず不適格となる問題を防ぐもの(cpprefjpの戻り値の記述はもともとこの意味を表している) diff --git a/reference/optional/optional/op_less.md b/reference/optional/optional/op_less.md index 1c19fa5903..f9a7953e91 100644 --- a/reference/optional/optional/op_less.md +++ b/reference/optional/optional/op_less.md @@ -104,3 +104,5 @@ int main() - [LWG Issue 2934. `optional` doesn't compare with `T`](https://wg21.cmeerw.net/lwg/issue2934) - [P1614R2 The Mothership has Landed](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1614r2.html) - C++20での三方比較演算子の追加と、関連する演算子の自動導出 +- [LWG Issue 4370. Comparison of `optional` to `T` may be ill-formed](https://cplusplus.github.io/LWG/issue4370) + - C++26で、効果が三項演算子形式(`x.has_value() ? *x == v : false`)から`if`文形式へ変更された。比較結果が`bool`以外の型を返す場合に三項演算子で共通型が得られず不適格となる問題を防ぐもの(cpprefjpの戻り値の記述はもともとこの意味を表している) diff --git a/reference/optional/optional/op_less_equal.md b/reference/optional/optional/op_less_equal.md index 8cbe8e8712..c514180ad6 100644 --- a/reference/optional/optional/op_less_equal.md +++ b/reference/optional/optional/op_less_equal.md @@ -104,3 +104,5 @@ int main() - [LWG Issue 2934. `optional` doesn't compare with `T`](https://wg21.cmeerw.net/lwg/issue2934) - [P1614R2 The Mothership has Landed](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1614r2.html) - C++20での三方比較演算子の追加と、関連する演算子の自動導出 +- [LWG Issue 4370. Comparison of `optional` to `T` may be ill-formed](https://cplusplus.github.io/LWG/issue4370) + - C++26で、効果が三項演算子形式(`x.has_value() ? *x == v : false`)から`if`文形式へ変更された。比較結果が`bool`以外の型を返す場合に三項演算子で共通型が得られず不適格となる問題を防ぐもの(cpprefjpの戻り値の記述はもともとこの意味を表している) diff --git a/reference/optional/optional/op_not_equal.md b/reference/optional/optional/op_not_equal.md index f70ff943d1..5cfa806100 100644 --- a/reference/optional/optional/op_not_equal.md +++ b/reference/optional/optional/op_not_equal.md @@ -101,3 +101,5 @@ int main() - [LWG Issue 2934. `optional` doesn't compare with `T`](https://wg21.cmeerw.net/lwg/issue2934) - [P1614R2 The Mothership has Landed](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1614r2.html) - C++20での三方比較演算子の追加と、関連する演算子の自動導出 +- [LWG Issue 4370. Comparison of `optional` to `T` may be ill-formed](https://cplusplus.github.io/LWG/issue4370) + - C++26で、効果が三項演算子形式(`x.has_value() ? *x == v : false`)から`if`文形式へ変更された。比較結果が`bool`以外の型を返す場合に三項演算子で共通型が得られず不適格となる問題を防ぐもの(cpprefjpの戻り値の記述はもともとこの意味を表している) diff --git a/reference/optional/optional/transform.md b/reference/optional/optional/transform.md index 2eb9ee224a..15580d184c 100644 --- a/reference/optional/optional/transform.md +++ b/reference/optional/optional/transform.md @@ -123,3 +123,5 @@ int main() - [P0798R8 Monadic operations for std::optional](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p0798r8.html) - [P2988R12 `std::optional`](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p2988r12.pdf) - C++26で参照型`T&`に対する部分特殊化を追加 +- [LWG Issue 4299. Missing `Mandates:` part in `optional::transform`](https://cplusplus.github.io/LWG/issue4299) + - C++26で、`optional`版 (5) の適格要件に「`U`が`optional`に対する有効な要素型であること」が追加された diff --git a/reference/optional/optional/value.md b/reference/optional/optional/value.md index b231ea50fa..fb0a3cd33f 100644 --- a/reference/optional/optional/value.md +++ b/reference/optional/optional/value.md @@ -37,6 +37,10 @@ constexpr T& value() const; // (5) C++26 有効値を保持していない状態でこの関数が呼び出された場合、[`bad_optional_access`](/reference/optional/bad_optional_access.md)例外を送出する。 +## 備考 +この関数は、例外を送出しうるため、フリースタンディング処理系では削除される(フリースタンディング処理系では使用できない)。 + + ## 例 ```cpp example #include diff --git a/reference/random.md b/reference/random.md index 9e2aab5445..7bbd577212 100644 --- a/reference/random.md +++ b/reference/random.md @@ -9,6 +9,9 @@ - [``](initializer_list.md) +## フリースタンディング +このヘッダの一部の機能が、フリースタンディング処理系でも使用できる。どの機能が使用できるかは各機能のページを参照。 + ## コンセプト | 名前 | 説明 | 対応バージョン | diff --git a/reference/random/linear_congruential_engine.md b/reference/random/linear_congruential_engine.md index 9f056f18e0..416e8f6a21 100644 --- a/reference/random/linear_congruential_engine.md +++ b/reference/random/linear_congruential_engine.md @@ -98,6 +98,10 @@ C言語から引き継いだ標準ライブラリ関数[`std::rand()`](/referenc | [`operator>>`](linear_congruential_engine/op_istream.md) | ストリームからの入力 | C++11 | + +## 備考 +このクラステンプレートは、フリースタンディング処理系でも使用できる。 + ## 例 ```cpp example #include diff --git a/reference/random/mersenne_twister_engine.md b/reference/random/mersenne_twister_engine.md index 3636b1d31e..bf16c12ede 100644 --- a/reference/random/mersenne_twister_engine.md +++ b/reference/random/mersenne_twister_engine.md @@ -122,6 +122,10 @@ namespace std { | [`operator>>`](mersenne_twister_engine/op_istream.md) | ストリームからの入力 | C++11 | + +## 備考 +このクラステンプレートは、フリースタンディング処理系でも使用できる。 + ## 例 ```cpp example #include diff --git a/reference/random/minstd_rand.md b/reference/random/minstd_rand.md index da65f6d303..d9f29a680a 100644 --- a/reference/random/minstd_rand.md +++ b/reference/random/minstd_rand.md @@ -21,6 +21,8 @@ namespace std { ## 備考 +この型は、フリースタンディング処理系でも使用できる。 + C言語標準ライブラリの`rand()`関数は、実装によっては問題のある[線形合同法](linear_congruential_engine.md)のパラメータが設定されていた。たとえば、実装によっては以下のような問題が発生していた。 - 生成される値の最下位ビットは、`0`と`1`が交互に生成されていた。これにより、生成される値は偶数と奇数が交互になっていた。 diff --git a/reference/random/minstd_rand0.md b/reference/random/minstd_rand0.md index 918dd0ec63..d1495d09ec 100644 --- a/reference/random/minstd_rand0.md +++ b/reference/random/minstd_rand0.md @@ -23,6 +23,8 @@ namespace std { ## 備考 +この型は、フリースタンディング処理系でも使用できる。 + C言語標準ライブラリの`rand()`関数は、実装によっては問題のある[線形合同法](linear_congruential_engine.md)のパラメータが設定されていた。たとえば、実装によっては以下のような問題が発生していた。 - 生成される値の最下位ビットは、`0`と`1`が交互に生成されていた。これにより、生成される値は偶数と奇数が交互になっていた。 diff --git a/reference/random/mt19937.md b/reference/random/mt19937.md index 71336b4438..15fc91ef24 100644 --- a/reference/random/mt19937.md +++ b/reference/random/mt19937.md @@ -61,6 +61,10 @@ namespace std { 参照 : [Mersenne Twisterの次に出す値を推測する - 憂鬱な午後のひととき](http://herumi.in.coocan.jp/diary/1505.html#18) + +## 備考 +この型は、フリースタンディング処理系でも使用できる。 + ## 例 ```cpp example #include diff --git a/reference/random/mt19937_64.md b/reference/random/mt19937_64.md index edc018dae0..7173664066 100644 --- a/reference/random/mt19937_64.md +++ b/reference/random/mt19937_64.md @@ -59,6 +59,10 @@ namespace std { [`uint_fast64_t`](/reference/cstdint/uint_fast64_t.md) + +## 備考 +この型は、フリースタンディング処理系でも使用できる。 + ## 例 ```cpp example #include diff --git a/reference/random/philox4x32.md b/reference/random/philox4x32.md index 7aaa75eca4..4477665854 100644 --- a/reference/random/philox4x32.md +++ b/reference/random/philox4x32.md @@ -34,6 +34,8 @@ namespace std { ## 備考 +この型は、フリースタンディング処理系でも使用できる。 + - ここではラウンド数として`r = 10`を設定している。この値を大きくすれば乱数の品質は向上し、統計的により良い分布になっていく。`10`という値は既知の統計検定に合格する最小値よりやや大きめであり、広く使用されている値である。言い換えれば、適度な性能コストで統計的な安全マージンを提供している - `r = 7`でも統計的な欠陥は見つかっていないが、実際には`r = 10`だけが広く使われている diff --git a/reference/random/philox4x64.md b/reference/random/philox4x64.md index 6ee4157e67..7e4fe475e0 100644 --- a/reference/random/philox4x64.md +++ b/reference/random/philox4x64.md @@ -34,6 +34,8 @@ namespace std { ## 備考 +この型は、フリースタンディング処理系でも使用できる。 + - ここではラウンド数として`r = 10`を設定している。この値を大きくすれば乱数の品質は向上し、統計的により良い分布になっていく。`10`という値は既知の統計検定に合格する最小値よりやや大きめであり、広く使用されている値である。言い換えれば、適度な性能コストで統計的な安全マージンを提供している - `r = 7`でも統計的な欠陥は見つかっていないが、実際には`r = 10`だけが広く使われている diff --git a/reference/random/philox_engine.md b/reference/random/philox_engine.md index 9c42e184dd..d7c9a82e73 100644 --- a/reference/random/philox_engine.md +++ b/reference/random/philox_engine.md @@ -161,6 +161,10 @@ $ r \cdot w $ ビット | [`operator>>`](philox_engine/op_istream.md) | ストリームからの入力 | C++26 | + +## 備考 +このクラステンプレートは、フリースタンディング処理系でも使用できる。 + ## 例 ### 基本的な使い方 ```cpp example diff --git a/reference/random/ranlux24.md b/reference/random/ranlux24.md index b7ee359ad2..01d8e8863c 100644 --- a/reference/random/ranlux24.md +++ b/reference/random/ranlux24.md @@ -52,6 +52,10 @@ RANLUX法は、0から4までの贅沢さレベル(luxury level)が選択可能 [`uint_fast32_t`](/reference/cstdint/uint_fast32_t.md) + +## 備考 +この型は、フリースタンディング処理系でも使用できる。 + ## 例 ```cpp example #include diff --git a/reference/random/ranlux24_base.md b/reference/random/ranlux24_base.md index 640571dc08..62f2d0a789 100644 --- a/reference/random/ranlux24_base.md +++ b/reference/random/ranlux24_base.md @@ -28,6 +28,10 @@ namespace std { [`uint_fast32_t`](/reference/cstdint/uint_fast32_t.md) + +## 備考 +この型は、フリースタンディング処理系でも使用できる。 + ## バージョン ### 言語 - C++11 diff --git a/reference/random/ranlux48.md b/reference/random/ranlux48.md index 2fb536e790..5d2df005a8 100644 --- a/reference/random/ranlux48.md +++ b/reference/random/ranlux48.md @@ -52,6 +52,10 @@ RANLUX法は、0から4までの贅沢さレベル(luxury level)が選択可能 [`uint_fast64_t`](/reference/cstdint/uint_fast64_t.md) + +## 備考 +この型は、フリースタンディング処理系でも使用できる。 + ## 例 ```cpp example #include diff --git a/reference/random/ranlux48_base.md b/reference/random/ranlux48_base.md index 9a41594634..3d03bb19a8 100644 --- a/reference/random/ranlux48_base.md +++ b/reference/random/ranlux48_base.md @@ -28,6 +28,10 @@ namespace std { [`uint_fast64_t`](/reference/cstdint/uint_fast64_t.md) + +## 備考 +この型は、フリースタンディング処理系でも使用できる。 + ## バージョン ### 言語 - C++11 diff --git a/reference/random/subtract_with_carry_engine.md b/reference/random/subtract_with_carry_engine.md index 7d460bc8df..5a343dcef6 100644 --- a/reference/random/subtract_with_carry_engine.md +++ b/reference/random/subtract_with_carry_engine.md @@ -96,6 +96,10 @@ namespace std { | [`operator>>`](subtract_with_carry_engine/op_istream.md) | ストリームからの入力 | C++11 | + +## 備考 +このクラステンプレートは、フリースタンディング処理系でも使用できる。 + ## 例 ```cpp example #include diff --git a/reference/random/uniform_random_bit_generator.md b/reference/random/uniform_random_bit_generator.md index 6f851b75f2..96c899061e 100644 --- a/reference/random/uniform_random_bit_generator.md +++ b/reference/random/uniform_random_bit_generator.md @@ -31,6 +31,10 @@ namespace std { - `g() <= G::max()`であること - `g()`の時間/空間計算量は償却定数であること + +## 備考 +このコンセプトは、フリースタンディング処理系でも使用できる。 + ## 例 ```cpp example #include diff --git a/reference/ranges.md b/reference/ranges.md index a9680a8ecb..a3007bf05d 100644 --- a/reference/ranges.md +++ b/reference/ranges.md @@ -13,6 +13,10 @@ C++17までは、標準アルゴリズム関数はイテレータの組を扱い また、Range対応版のアルゴリズム関数は引き続き[``](algorithm.md)で提供される。 + +## フリースタンディング +このヘッダのほとんどの機能は、フリースタンディング処理系でも使用できる。ただし、例外を送出する一部の機能などは、フリースタンディング処理系では提供されない、または削除される。詳細は各機能のページを参照。 + ## 名前空間構造 ``で定義されるものは全て`std::ranges`名前空間の下にある。また、各種`view`型を生成するRangeアダプタ/ファクトリオブジェクトは`std::ranges::views`名前空間の下で定義され、`std::views`からもアクセスする事ができる。 diff --git a/reference/ranges/basic_istream_view.md b/reference/ranges/basic_istream_view.md index c7e6bbd878..ff3786b174 100644 --- a/reference/ranges/basic_istream_view.md +++ b/reference/ranges/basic_istream_view.md @@ -80,6 +80,10 @@ concept stream-extractable = requires(basic_istream& is, Val& t) | [`cend`](view_interface/cend.md) | 定数イテレータ(番兵)を取得する | C++23 | + +## 備考 +このクラスは、フリースタンディング処理系では使用できない。 + ## 例 ```cpp example #include diff --git a/reference/ranges/concat_view/end.md b/reference/ranges/concat_view/end.md index df17e204b7..89bfd7719e 100644 --- a/reference/ranges/concat_view/end.md +++ b/reference/ranges/concat_view/end.md @@ -14,10 +14,13 @@ constexpr auto end() const ``` ## 概要 -番兵を取得する。 +終端イテレータもしくは番兵を取得する。 -## 戻り値 -- (1), (2) : `concat_view`の番兵を返す +## 効果 +`is-const`を、`const`修飾版の (2) では`true`、非`const`版の (1) では`false`とする。`Views`の要素数を`N`として、以下と等価である: + +- 全ての範囲(`is-const`に応じて`const`修飾したもの)が[`forward_range`](/reference/ranges/forward_range.md)であり、かつ最後の範囲`Views...[N - 1]`が[`common_range`](/reference/ranges/common_range.md)である場合、最後の範囲の終端を指す`concat_view`のイテレータを返す。 +- そうでなければ、[`default_sentinel`](/reference/iterator/default_sentinel_t.md)を返す。 ## 例 @@ -60,3 +63,8 @@ int main() { - [Clang](/implementation.md#clang): 23 [mark verified] - [GCC](/implementation.md#gcc): 15 [mark verified] - [Visual C++](/implementation.md#visual_cpp): 2022 Update 14 [mark noimpl] + + +## 参照 +- [LWG Issue 4166. `concat_view::end()` should be more constrained in order to support noncopyable iterators](https://cplusplus.github.io/LWG/issue4166) + - C++26で、`end()`の効果で終端イテレータを返す条件に「全ての範囲が`forward_range`であること」(`all-forward`)が追加された。一部の範囲が前方範囲でない場合にイテレータを返してしまい、コピー不可能なイテレータを含む場合などに問題が生じるのを防ぐもの diff --git a/reference/ranges/elements_of.md b/reference/ranges/elements_of.md index e6c0b3e2f8..d34a9c7f21 100644 --- a/reference/ranges/elements_of.md +++ b/reference/ranges/elements_of.md @@ -35,6 +35,10 @@ namespace std::ranges { | `allocator` | Allocator | C++23 | + +## 備考 +このクラスは、フリースタンディング処理系では使用できない。 + ## 例 ```cpp example #include diff --git a/reference/ratio.md b/reference/ratio.md index 188c13e8ec..2a7b0f4734 100644 --- a/reference/ratio.md +++ b/reference/ratio.md @@ -5,6 +5,10 @@ ``ヘッダでは、コンパイル時有理数演算のための、いくつかのクラスを定義する。 +## フリースタンディング +このヘッダは、フリースタンディング処理系でも使用できる。本ヘッダが提供する全ての機能がフリースタンディング処理系で使用可能である。 + + ## `ratio`クラステンプレート | 名前 | 説明 | 対応バージョン | diff --git a/reference/simd/alignment.md b/reference/simd/alignment.md index 66518e5aa2..e9f12b8cae 100644 --- a/reference/simd/alignment.md +++ b/reference/simd/alignment.md @@ -15,11 +15,11 @@ namespace std::simd { ``` ## 概要 -`alignment`は、データ並列型`T`([`basic_vec`](basic_vec.md)または[`basic_mask`](basic_mask.md))を、要素型`U`の配列に対してアライメント済みで読み込み/書き込むために必要な、メモリ先頭のアライメント(バイト数)を取得する型特性である。 +`alignment`は、データ並列型`T`([`basic_vec`](basic_vec.md))を、要素型`U`の配列に対してアライメント済みで読み込み/書き込むために必要な、メモリ先頭のアライメント(バイト数)を取得する型特性である。 [`flag_aligned`](flags.md)を指定して読み込み/書き込む場合、メモリ先頭はこの`alignment_v`バイト境界にアライメントされていなければならない。 -メンバ定数`value`は、`T`がデータ並列型であり、要素型`U`との間で(変換)読み込み/書き込みが可能な場合にのみ存在する。 +メンバ定数`value`は、`T`が[`basic_vec`](basic_vec.md)の特殊化であり、`U`が[vectorizable type](/reference/simd.md#vectorizable-type)である場合にのみ存在する。 ## 例 @@ -63,3 +63,5 @@ int main() ## 参照 - [P1928R15 std::simd — merge data-parallel types from the Parallelism TS 2](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p1928r15.pdf) - C++26で`std::simd`ライブラリが追加された +- [LWG Issue 4413. Unused/left-over `simd::alignment` specialization for `basic_mask`](https://cplusplus.github.io/LWG/issue4413) + - C++26で、メンバ定数`value`が存在する条件から`basic_mask`と`bool`の組み合わせが削除され、`basic_vec`の特殊化かつ`U`がvectorizable typeの場合のみとなった diff --git a/reference/simd/basic_mask/op_constructor.md b/reference/simd/basic_mask/op_constructor.md index 35f45da099..91db3a5664 100644 --- a/reference/simd/basic_mask/op_constructor.md +++ b/reference/simd/basic_mask/op_constructor.md @@ -124,3 +124,5 @@ false true false true - C++26で追加された - [P3430R3 SIMD issues: explicit, unsequenced, identity-element position, and members of disabled SIMD](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3430r3.pdf) - ジェネレータコンストラクタから`noexcept`が除去された +- [LWG Issue 4382. The `simd::basic_mask(bool)` overload needs to be more constrained](https://cplusplus.github.io/LWG/issue4382) + - C++26で、(2) `value_type`をとるコンストラクタが`same_as auto`に、(5) `bitset`をとるコンストラクタが`same_as> T`に、(6) 符号なし整数型をとるコンストラクタが`unsigned_integral T`かつ`!same_as`に、それぞれ制約された diff --git a/reference/simd/basic_vec/op_deduction_guide.md b/reference/simd/basic_vec/op_deduction_guide.md index a9bb56f180..2d3e278d3b 100644 --- a/reference/simd/basic_vec/op_deduction_guide.md +++ b/reference/simd/basic_vec/op_deduction_guide.md @@ -18,7 +18,7 @@ namespace std::simd { ## 概要 `basic_vec`クラステンプレートの型推論補助。 -- (1) : 連続範囲(contiguous range)かつ要素数が定数式となる範囲から推論する。推論される型は`vec, std::ranges::size(r)>`と等価である。 +- (1) : 連続範囲(contiguous range)かつ要素数が定数式となる範囲から推論する。推論される型は`vec, static_cast(std::ranges::size(r))>`と等価である(`simd-size-type`は`std::simd`が用いる符号付きの要素数型)。 - (2) : [`basic_mask`](../basic_mask.md)から推論する。推論される型は`decltype(+k)`(マスクに単項プラスを適用して得られる`basic_vec`)と等価である。 @@ -85,3 +85,5 @@ int main() - C++26で追加された - [P3922R1 Missing deduction guide from `simd::mask` to `simd::vec`](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3922r1.pdf) - `basic_mask`から`basic_vec`への推論補助が追加された +- [LWG Issue 4403. `simd::basic_vec` CTAD misses difference type casting](https://cplusplus.github.io/LWG/issue4403) + - C++26で、推論される要素数が`static_cast(ranges::size(r))`となるよう修正された。`ranges::size`が返す符号なし整数を、`std::simd`が用いる符号付きの要素数型へ明示的にキャストするもの diff --git a/reference/simd/bit_ceil.md b/reference/simd/bit_ceil.md index 1a45079731..960c875222 100644 --- a/reference/simd/bit_ceil.md +++ b/reference/simd/bit_ceil.md @@ -88,3 +88,5 @@ int main() - C++26で`std::simd`ライブラリが追加された - [P2933R4 Extend `` header function with overloads for `std::simd`](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p2933r4.html) - C++26で``ヘッダの関数に`std::simd`向けのオーバーロードが追加された +- [LWG Issue 4375. `std::simd::bit_ceil` should not be `noexcept`](https://cplusplus.github.io/LWG/issue4375) + - C++26で、`bit_ceil`から`noexcept`指定が削除された。結果が表現できない場合に事前条件違反となりうるため、スカラー版の[`std::bit_ceil`](/reference/bit/bit_ceil.md)と同様に`noexcept`を付けない形に修正された diff --git a/reference/simd/partial_load.md b/reference/simd/partial_load.md index 362e58d6b8..981add7a81 100644 --- a/reference/simd/partial_load.md +++ b/reference/simd/partial_load.md @@ -151,5 +151,7 @@ int main() ## 参照 - [P1928R15 std::simd — merge data-parallel types from the Parallelism TS 2](https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p1928r15.pdf) - C++26で`std::simd`ライブラリに追加された +- [LWG Issue 4280. `simd::partial_load` uses undefined identifier `T`](https://cplusplus.github.io/LWG/issue4280) + - C++26で、仕様の記述が「効果(Effects)」から「戻り値(Returns)」へ改められ、式中で使われている識別子`T`が`V::value_type`であることが明記された(識別子が定義されていなかった記述上の欠陥の修正) - [LWG Issue 4420. §[simd] conversions (constructor, load, stores, gather, and scatter) are incorrectly constrained for `` types](https://cplusplus.github.io/LWG/issue4420) - C++26で、要素型が異なるメモリからの読み込みで、`static_cast`による明示的変換を正しく扱うよう制約・効果が修正された diff --git a/reference/simd/permute.md b/reference/simd/permute.md index 467bd4db8b..00bfdec206 100644 --- a/reference/simd/permute.md +++ b/reference/simd/permute.md @@ -116,3 +116,5 @@ int main() - C++26で`std::simd`ライブラリが追加された - [P2664R11 Proposal to extend `std::simd` with permutation API](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p2664r11.html) - C++26で置換API(`permute`)が追加された +- [LWG Issue 4412. Fix declaration of `zero_element` and `uninit_element`](https://cplusplus.github.io/LWG/issue4412) + - C++26で、`zero_element`・`uninit_element`の宣言が`static constexpr`から`inline constexpr`へ修正された(名前空間スコープの定数のため) diff --git a/reference/source_location.md b/reference/source_location.md index 127a4d3b5b..1f21984ecb 100644 --- a/reference/source_location.md +++ b/reference/source_location.md @@ -4,7 +4,8 @@ ``ヘッダは、ソースコード上の位置を表す型を提供する。 -本ヘッダはフリースタンディング環境でも提供される。 +## フリースタンディング +このヘッダは、フリースタンディング処理系でも使用できる。本ヘッダが提供する全ての機能がフリースタンディング処理系で使用可能である。 | 名前 | 説明 | 対応バージョン | |---------------------------------------------------------|------------------------------------------|----------------| diff --git a/reference/span.md b/reference/span.md index f28118b647..75a2956ca0 100644 --- a/reference/span.md +++ b/reference/span.md @@ -4,6 +4,10 @@ ``ヘッダでは、所有権を持たず任意のシーケンスの部分シーケンスを参照する機能を定義する。 + +## フリースタンディング +このヘッダのほとんどの機能は、フリースタンディング処理系でも使用できる。ただし、例外を送出する一部の機能などは、フリースタンディング処理系では提供されない、または削除される。詳細は各機能のページを参照。 + | 名前 | 説明 | 対応バージョン | |------------------------------------------|--------------------------|-------| | [`dynamic_extent`](span/dynamic_extent.md) | 動的な要素数を表す値 (variable) | C++20 | diff --git a/reference/span/dynamic_extent.md b/reference/span/dynamic_extent.md index 4a74e7f1a0..c10492a54a 100644 --- a/reference/span/dynamic_extent.md +++ b/reference/span/dynamic_extent.md @@ -16,6 +16,8 @@ namespace std { ## 概要 `dynamic_extent`は、動的な要素数をもつことを[`std::span`](span.md)や[`std::mdspan`](../mdspan/mdspan.md)に指示するための定数である。 +この定数は``ヘッダで定義されるが、C++26以降は``ヘッダのインクルードによっても利用可能である。 + ### std::span 以下のような状況で、[`span`](span.md)クラスは動的な要素数をもつようになる: @@ -81,3 +83,8 @@ int main() ## 関連項目 - C++20 [`span`](span.md) - C++23 [`mdspan`](../mdspan/mdspan.md) + + +## 参照 +- [LWG Issue 4275. `std::dynamic_extent` should also be defined in ``](https://cplusplus.github.io/LWG/issue4275) + - C++26で、`dynamic_extent`が``に加えて``のインクルードによっても利用可能になった diff --git a/reference/span/integral-constant-like.md b/reference/span/integral-constant-like.md index 993ccb8eb5..e4706e4bc7 100644 --- a/reference/span/integral-constant-like.md +++ b/reference/span/integral-constant-like.md @@ -8,7 +8,7 @@ template concept integral-constant-like = // exposition only is_integral_v> && - !is_same_v> && + !is_same_v> && convertible_to && equality_comparable_with && bool_constant::value && @@ -16,7 +16,6 @@ concept integral-constant-like = // exposition only ``` * is_integral_v[link /reference/type_traits/is_integral.md] * is_same_v[link /reference/type_traits/is_same.md] -* remove_const_t[link /reference/type_traits/remove_const.md] * remove_cvref_t[link /reference/type_traits/remove_cvref.md] * bool_constant[link /reference/type_traits/bool_constant.md] * equality_comparable_with[link /reference/concepts/equality_comparable.md] @@ -35,3 +34,5 @@ concept integral-constant-like = // exposition only - [P3029R1 Better `mdspan`'s CTAD](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3029r1.html) - [LWG Issue 4486. `integral-constant-like` and `constexpr-wrapper-like` exposition-only concept duplication](https://cplusplus.github.io/LWG/issue4486) - C++26で、`decltype(T::value)`に`remove_cvref_t`を適用するよう修正され、``と``で重複していた制約が説明専用コンセプト`constexpr-wrapper-like`へ集約された +- [LWG Issue 4351. `integral-constant-like` needs more `remove_cvref_t`](https://cplusplus.github.io/LWG/issue4351) + - C++26で、`bool`型を除外する制約`!is_same_v`でも`remove_const_t`ではなく`remove_cvref_t`を用いるよう修正された(参照修飾された`bool`定数が誤って許容されるのを防ぐもの) diff --git a/reference/span/span/as_bytes.md b/reference/span/span/as_bytes.md index 16fcb4397c..2380bfd7c4 100644 --- a/reference/span/span/as_bytes.md +++ b/reference/span/span/as_bytes.md @@ -21,6 +21,10 @@ namespace std { この関数を使用することで、メモリ連続性をもつ要素列をバイト列として扱える。シリアライズやデータ転送といった、バイト指向アクセスが必要なシステムプログラミングに使用できる。 +## テンプレートパラメータ制約 +- C++26 : [`is_volatile_v`](/reference/type_traits/is_volatile.md)` == false`であること + + ## 戻り値 以下と等価: @@ -76,3 +80,8 @@ int main() - [Clang](/implementation.md#clang): 9.0 [mark verified] - [GCC](/implementation.md#gcc): ?? - [Visual C++](/implementation.md#visual_cpp): ?? + + +## 参照 +- [LWG Issue 4243. `as_bytes`/`as_writable_bytes` is broken with `span`](https://cplusplus.github.io/LWG/issue4243) + - C++26で、`ElementType`が`volatile`修飾されている場合に`reinterpret_cast`がハードエラーとなる問題を防ぐため、`is_volatile_v == false`のテンプレートパラメータ制約が追加された diff --git a/reference/span/span/as_writable_bytes.md b/reference/span/span/as_writable_bytes.md index 4b55186383..25ba30902b 100644 --- a/reference/span/span/as_writable_bytes.md +++ b/reference/span/span/as_writable_bytes.md @@ -21,6 +21,11 @@ namespace std { この関数を使用することで、メモリ連続性をもつ要素列をバイト列として扱える。シリアライズやデータ転送といった、バイト指向アクセスが必要なシステムプログラミングに使用できる。 +## テンプレートパラメータ制約 +- [`is_const_v`](/reference/type_traits/is_const.md)` == false`であること +- C++26 : [`is_volatile_v`](/reference/type_traits/is_volatile.md)` == false`であること + + ## 戻り値 以下と等価: @@ -89,3 +94,8 @@ int main() - [Clang](/implementation.md#clang): 9.0 [mark verified] - [GCC](/implementation.md#gcc): ?? - [Visual C++](/implementation.md#visual_cpp): ?? + + +## 参照 +- [LWG Issue 4243. `as_bytes`/`as_writable_bytes` is broken with `span`](https://cplusplus.github.io/LWG/issue4243) + - C++26で、`ElementType`が`volatile`修飾されている場合に`reinterpret_cast`がハードエラーとなる問題を防ぐため、`is_volatile_v == false`のテンプレートパラメータ制約が追加された diff --git a/reference/span/span/at.md b/reference/span/span/at.md index 3f20152761..023b3f7a9f 100644 --- a/reference/span/span/at.md +++ b/reference/span/span/at.md @@ -26,6 +26,10 @@ return *(data() + i); 定数時間 + +## 備考 +この関数は、例外を送出しうるため、フリースタンディング処理系では削除される(フリースタンディング処理系では使用できない)。 + ## 例外 `i >=` [`size()`](size.md)の場合、[`out_of_range`](/reference/stdexcept.md)例外を送出する。 diff --git a/reference/span/span/first.md b/reference/span/span/first.md index 5e212dbee2..d3c7207e68 100644 --- a/reference/span/span/first.md +++ b/reference/span/span/first.md @@ -32,10 +32,10 @@ constexpr span ## 戻り値 -(1)であれば`Count`を`N`、(2)であれば`count`を`N`として、以下と等価: +(1)であれば`Count`を`N`、(2)であれば`count`を`N`とし、`R`を戻り値の型として、以下と等価: ```cpp -return {data(), N}; +return R(data(), N); ``` * data()[link data.md] @@ -99,4 +99,6 @@ int main() - [P1872R0 `span` should have `size_type`, not `index_type`](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1872r0.pdf) - [LWG Issue 3103. Errors in taking subview of `span` should be ill-formed where possible](https://wg21.cmeerw.net/lwg/issue3103) - [P3471R4 Standard library hardening](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3471r4.html) +- [LWG Issue 4293. `span::subspan`/`first`/`last` chooses wrong constructor when `T` is const-qualified `bool`](https://cplusplus.github.io/LWG/issue4293) + - C++26で、効果が波カッコ初期化`R{...}`から丸カッコ構築`R(...)`へ変更された。要素型が`bool`(`const bool`など)のとき、リスト初期化が意図しないコンストラクタ(`initializer_list`をとるもの)を選んでしまう問題を防ぐもの - [P3878R1 Standard library hardening should not use the 'observe' semantic](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3878r1.html) diff --git a/reference/span/span/last.md b/reference/span/span/last.md index f8bd9cc316..25dd5fedff 100644 --- a/reference/span/span/last.md +++ b/reference/span/span/last.md @@ -32,10 +32,10 @@ constexpr span ## 戻り値 -(1)であれば`Count`を`N`、(2)であれば`count`を`N`として、以下と等価: +(1)であれば`Count`を`N`、(2)であれば`count`を`N`とし、`R`を戻り値の型として、以下と等価: ```cpp -return {data() + (size() - N), N}; +return R(data() + (size() - N), N); ``` * data()[link data.md] * size()[link size.md] @@ -100,4 +100,6 @@ int main() - [P1872R0 `span` should have `size_type`, not `index_type`](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1872r0.pdf) - [LWG Issue 3103. Errors in taking subview of `span` should be ill-formed where possible](https://wg21.cmeerw.net/lwg/issue3103) - [P3471R4 Standard library hardening](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3471r4.html) +- [LWG Issue 4293. `span::subspan`/`first`/`last` chooses wrong constructor when `T` is const-qualified `bool`](https://cplusplus.github.io/LWG/issue4293) + - C++26で、効果が波カッコ初期化`R{...}`から丸カッコ構築`R(...)`へ変更された。要素型が`bool`(`const bool`など)のとき、リスト初期化が意図しないコンストラクタ(`initializer_list`をとるもの)を選んでしまう問題を防ぐもの - [P3878R1 Standard library hardening should not use the 'observe' semantic](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3878r1.html) diff --git a/reference/span/span/subspan.md b/reference/span/span/subspan.md index fc5869dd6e..2a34aaa562 100644 --- a/reference/span/span/subspan.md +++ b/reference/span/span/subspan.md @@ -52,7 +52,8 @@ constexpr span - (2) : 以下と等価: ```cpp - return {data() + offset, count == dynamic_extent ? size() - offset : count}; + return span( + data() + offset, count == dynamic_extent ? size() - offset : count); ``` * data()[link data.md] * dynamic_extent[link /reference/span/dynamic_extent.md] @@ -117,4 +118,6 @@ int main() - [P1872R0 `span` should have `size_type`, not `index_type`](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1872r0.pdf) - [LWG Issue 3103. Errors in taking subview of `span` should be ill-formed where possible](https://wg21.cmeerw.net/lwg/issue3103) - [P3471R4 Standard library hardening](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3471r4.html) +- [LWG Issue 4293. `span::subspan`/`first`/`last` chooses wrong constructor when `T` is const-qualified `bool`](https://cplusplus.github.io/LWG/issue4293) + - C++26で、効果が波カッコ初期化`R{...}`から丸カッコ構築`R(...)`へ変更された。要素型が`bool`(`const bool`など)のとき、リスト初期化が意図しないコンストラクタ(`initializer_list`をとるもの)を選んでしまう問題を防ぐもの - [P3878R1 Standard library hardening should not use the 'observe' semantic](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3878r1.html) diff --git a/reference/string.md b/reference/string.md index 9a778177d5..a4079f4dbd 100644 --- a/reference/string.md +++ b/reference/string.md @@ -9,6 +9,9 @@ - [``](compare.md) (C++20) +## フリースタンディング +このヘッダの一部の機能が、フリースタンディング処理系でも使用できる。どの機能が使用できるかは各機能のページを参照。 + ## 文字特性 | 名前 | 説明 | 対応バージョン | diff --git a/reference/string/char_traits.md b/reference/string/char_traits.md index 2843c92ac1..823c103991 100644 --- a/reference/string/char_traits.md +++ b/reference/string/char_traits.md @@ -112,6 +112,10 @@ namespace std { | `comparison_category` | [`strong_ordering`](/reference/compare/strong_ordering.md) | C++20 | + +## 備考 +このクラスは、フリースタンディング処理系でも使用できる。 + ## 例 ### 基本的な使い方 ```cpp example diff --git a/reference/string_view.md b/reference/string_view.md index 606e71b6e5..03762213c6 100644 --- a/reference/string_view.md +++ b/reference/string_view.md @@ -9,6 +9,9 @@ - [``](compare.md) (C++20) +## フリースタンディング +このヘッダのほとんどの機能は、フリースタンディング処理系でも使用できる。ただし、例外を送出する一部の機能などは、フリースタンディング処理系では提供されない、または削除される。詳細は各機能のページを参照。 + | 名前 | 説明 | 対応バージョン | |------------------------------------------|--------------------------|-------| | [`basic_string_view`](string_view/basic_string_view.md) | 所有権を持たない文字列クラス (class template) | C++17 | diff --git a/reference/string_view/basic_string_view/at.md b/reference/string_view/basic_string_view/at.md index 87ef28ac6f..6fbca769f2 100644 --- a/reference/string_view/basic_string_view/at.md +++ b/reference/string_view/basic_string_view/at.md @@ -20,6 +20,10 @@ return data()[pos]; * data()[link data.md] + +## 備考 +この関数は、例外を送出しうるため、フリースタンディング処理系では削除される(フリースタンディング処理系では使用できない)。 + ## 例外 `pos >=` [`size()`](size.md)の場合、[`std::out_of_range`](/reference/stdexcept.md)例外を送出する。 diff --git a/reference/string_view/basic_string_view/copy.md b/reference/string_view/basic_string_view/copy.md index e311b893b5..003d398644 100644 --- a/reference/string_view/basic_string_view/copy.md +++ b/reference/string_view/basic_string_view/copy.md @@ -35,6 +35,10 @@ Traits::copy(s, data() + pos, rlen); `rlen` + +## 備考 +この関数は、例外を送出しうるため、フリースタンディング処理系では削除される(フリースタンディング処理系では使用できない)。 + ## 例外 `pos >` [`size()`](size.md)の場合、[`std::out_of_range`](/reference/stdexcept.md)例外を送出する。 diff --git a/reference/string_view/basic_string_view/substr.md b/reference/string_view/basic_string_view/substr.md index db451e9483..d8d7c450ff 100644 --- a/reference/string_view/basic_string_view/substr.md +++ b/reference/string_view/basic_string_view/substr.md @@ -20,6 +20,10 @@ constexpr basic_string_view substr(size_type pos = 0, size_type n = npos) const; [`size()`](size.md) `- pos`と`n`うち、小さい方を`rlen`とし、`basic_string_view(`[`data()`](data.md) `+ pos, rlen)`を返す。 + +## 備考 +この関数は、例外を送出しうるため、フリースタンディング処理系では削除される(フリースタンディング処理系では使用できない)。 + ## 例外 `pos >` [`size()`](size.md)の場合、[`std::out_of_range`](/reference/stdexcept.md)例外を送出する。 diff --git a/reference/system_error.md b/reference/system_error.md index fb4bf74511..93458379a5 100644 --- a/reference/system_error.md +++ b/reference/system_error.md @@ -9,6 +9,9 @@ - [``](compare.md) (C++20) +## フリースタンディング +このヘッダの一部の機能が、フリースタンディング処理系でも使用できる。どの機能が使用できるかは各機能のページを参照。 + | 名前 | 説明 | 対応バージョン | |------------------------------------------------------|-----------------------------------------|-------| | [`error_category`](system_error/error_category.md) | エラーを分類するための基底クラス(class) | C++11 | diff --git a/reference/tuple.md b/reference/tuple.md index dd78d3628a..facaff08fd 100644 --- a/reference/tuple.md +++ b/reference/tuple.md @@ -9,6 +9,10 @@ - [``](compare.md) (C++20) +## フリースタンディング +このヘッダは、フリースタンディング処理系でも使用できる。本ヘッダが提供する全ての機能がフリースタンディング処理系で使用可能である。 + + ## タプルクラス | 名前 | 説明 | 対応バージョン | diff --git a/reference/type_traits.md b/reference/type_traits.md index 8f8a7189ac..d202a14b54 100644 --- a/reference/type_traits.md +++ b/reference/type_traits.md @@ -6,7 +6,8 @@ このライブラリに含まれるクラステンプレートは、メタ関数(meta function)と呼ばれている。 -本ヘッダはフリースタンディング環境でも提供される。 +## フリースタンディング +このヘッダは、フリースタンディング処理系でも使用できる。本ヘッダが提供する全ての機能がフリースタンディング処理系で使用可能である。 ## ヘルパークラス diff --git a/reference/typeinfo.md b/reference/typeinfo.md index 2ad35cdbc3..bd67a6d099 100644 --- a/reference/typeinfo.md +++ b/reference/typeinfo.md @@ -3,7 +3,8 @@ ``ヘッダは、`typeid`演算子および`dynamic_cast`演算子と共に使用する型を定義する。 -本ヘッダはフリースタンディング環境でも提供される。 +## フリースタンディング +このヘッダは、フリースタンディング処理系でも使用できる。本ヘッダが提供する全ての機能がフリースタンディング処理系で使用可能である。 | 名前 | 説明 | 対応バージョン | |------------------------------------------|-------------------------------------------------|-------| diff --git a/reference/utility.md b/reference/utility.md index 61c03502d1..d8d8078594 100644 --- a/reference/utility.md +++ b/reference/utility.md @@ -9,6 +9,10 @@ - [``](compare.md) (C++20) +## フリースタンディング +このヘッダは、フリースタンディング処理系でも使用できる。本ヘッダが提供する全ての機能がフリースタンディング処理系で使用可能である。 + + ## 演算子定義 | 名前 | 説明 | 対応バージョン | diff --git a/reference/variant.md b/reference/variant.md index dd41b9c0bf..fc42481850 100644 --- a/reference/variant.md +++ b/reference/variant.md @@ -9,6 +9,10 @@ - [``](compare.md) (C++20) +## フリースタンディング +このヘッダのほとんどの機能は、フリースタンディング処理系でも使用できる。ただし、[`std::get`](variant/variant/get.md)関数は、指定した型・インデックスと異なる値を保持しているときに例外を送出するため、フリースタンディング処理系では削除される。 + + | 名前 | 説明 | 対応バージョン | |------|------|----------------| | [`variant`](variant/variant.md) | 候補の型を切り替えながら保持できる記憶域型 (class template) | C++17 | diff --git a/reference/variant/variant/get.md b/reference/variant/variant/get.md index 8429c36bf7..81e71a0d8d 100644 --- a/reference/variant/variant/get.md +++ b/reference/variant/variant/get.md @@ -69,6 +69,8 @@ namespace std { ## 備考 +この関数は、例外を送出しうるため、フリースタンディング処理系では削除される(フリースタンディング処理系では使用できない)。 + - この関数がメンバ関数ではなく非メンバ関数として定義されているのは、ユーザーにtemplate限定子を指定させるのを避けるためである。メンバ関数にした場合、テンプレート内でその関数を使用すると、`v.template get()`のようにtemplateキーワードをユーザーが指定しなければならない - 同名の非メンバ関数`get()`がタプルインタフェースとして定義されているが、この関数はタプルインタフェースではない diff --git a/reference/variant/variant/op_constructor.md b/reference/variant/variant/op_constructor.md index 1f1c9e6332..4a1a455b3b 100644 --- a/reference/variant/variant/op_constructor.md +++ b/reference/variant/variant/op_constructor.md @@ -6,9 +6,9 @@ * cpp17[meta cpp] ```cpp -constexpr variant() noexcept(see below); // (1) -constexpr variant(const variant& other); // (2) -constexpr variant(variant&& other) noexcept(see below); // (3) +constexpr variant() noexcept(see below); // (1) +constexpr variant(const variant& other) noexcept(see below); // (2) +constexpr variant(variant&& other) noexcept(see below); // (3) template constexpr variant(T&& t) noexcept(see below); // (4) @@ -120,6 +120,7 @@ constexpr explicit variant(in_place_index_t, - `noexcept`内の式は、[`is_nothrow_default_constructible_v`](/reference/type_traits/is_nothrow_default_constructible.md)``と等価 - (2) : - 全ての型`Ti`の直接初期化が、任意の例外を送出する可能性がある + - `noexcept`内の式は、全ての`Ti`についての[`is_nothrow_copy_constructible_v`](/reference/type_traits/is_nothrow_copy_constructible.md)``を論理積したものと等価 - (3) : - 全ての型`Ti`のムーブ構築が、任意の例外を送出する可能性がある - `noexcept`内の式は、全ての`Ti`についての[`is_nothrow_move_constructible_v`](/reference/type_traits/is_nothrow_move_constructible.md)``を論理積したものと等価 @@ -363,10 +364,12 @@ int main() ## 参照 -- [LWG Issue 2901 Variants cannot properly support allocators](https://cplusplus.github.io/LWG/issue2901) - [P0608R3 A sane variant converting constructor](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0608r3.html) - [P0602R4 `variant` and `optional` should propagate copy/move triviality](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0602r4.html) +- [LWG Issue 2901 Variants cannot properly support allocators](https://cplusplus.github.io/LWG/issue2901) - [P0777R1 Treating Unnecessary `decay`](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0777r1.pdf) - C++20からテンプレートパラメータ制約の`decay_t`を`remove_cvref_t`へ変更。 +- [LWG Issue 2991. `variant` copy constructor missing `noexcept(see below)`](https://cplusplus.github.io/LWG/issue2991) + - コピーコンストラクタ(2)に`noexcept(see below)`が追加され、その例外指定が全ての`Ti`についての`is_nothrow_copy_constructible_v`を論理積したものと等価であることが規定された。ムーブコンストラクタと異なりコピー側で指定が欠落していた欠陥の修正であり、この仕様はC++26で規定されたが主要な実装は早期に対応している - [LWG Issue 4460. Missing _Throws_: for last `variant` constructor](https://cplusplus.github.io/LWG/issue4460) - `in_place_index_t`と`initializer_list`をとる(8)のコンストラクタに、他のコンストラクタと同様に「格納する値の初期化で送出された例外を送出する」旨のThrows節が規格に追加された(規格の記載漏れの修正) diff --git a/reference/version.md b/reference/version.md index b399d60fb6..d8a03cf1c0 100644 --- a/reference/version.md +++ b/reference/version.md @@ -4,7 +4,8 @@ ``ヘッダでは、実装依存でのC++標準ライブラリのバージョン情報を提供する。機能テストマクロ以外のバージョン情報以外に何が定義されるかは実装ごとに決められる。 -本ヘッダはフリースタンディング環境でも提供される。 +## フリースタンディング +このヘッダは、フリースタンディング処理系でも使用できる。本ヘッダが提供する全ての機能がフリースタンディング処理系で使用可能である。 ## 機能テストマクロ