Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
6e2f709
linalg : C++26 LWG Issue対応として、適格要件・事前条件・計算量の整理
faithandbrave Aug 14, 2026
b7f07c9
spanのas(_writable)_bytes : テンプレートパラメータ制約を追加
faithandbrave Aug 14, 2026
f1814ba
linalg : 適格要件を変更
faithandbrave Aug 14, 2026
80d944d
meta::data_member_spec : LWG Issueを追加
faithandbrave Aug 14, 2026
ab60c7f
expected::operator== : 戻り値の条件変更
faithandbrave Aug 14, 2026
bf7487c
variantのコンストラクタ : コピーコンストラクタのnoexcept条件を追加
faithandbrave Aug 14, 2026
d93e9d2
durationのコンストラクタ : オーバーフローしないことという文言の削除と代わりの仕様が入った
faithandbrave Aug 14, 2026
0f6531c
make_optional : LWG Issue対応として「〜と等価」という文言を追加
faithandbrave Aug 14, 2026
2379e6b
mdspan::extentsのindex-cast : remove_cvrefするよう仕様変更
faithandbrave Aug 14, 2026
3e1b78b
lingalg : エルミート関係のアルゴリズムで、実部のみが使用されることを備考に記載
faithandbrave Aug 14, 2026
45f9365
concat_view::end : 終端イテレータを返す条件としてforward_rangeであることが追加
faithandbrave Aug 14, 2026
403ac03
basic_const_iterator : C++26でiterator型を追加
faithandbrave Aug 14, 2026
e05621c
move_only_functionのコンストラクタ : 空のcopyable_functionから構築した場合でも状態をもたないことになった
faithandbrave Aug 14, 2026
4299074
local_time : C++26で制約を追加
faithandbrave Aug 14, 2026
01c9ca6
midpoint : CV修飾されたboolを除外
faithandbrave Aug 14, 2026
253a0ce
layout_stride::mapping : is_always_exhaustiveの定義をC++26で変更
faithandbrave Aug 14, 2026
c732446
unique_copy : LWG Issueを記載
faithandbrave Aug 14, 2026
b4a0fa0
hh_mm_ss : absを直接使わない仕様に変更
faithandbrave Aug 14, 2026
2072ab0
dynamic_extent : spanで定義されるこの機能がmdspanでも使用できるようになった
faithandbrave Aug 14, 2026
9d5fcfb
インデクス → インデックス
faithandbrave Aug 14, 2026
b168711
array::back, front : 長さ0の配列に対する呼び出しが、未定義ではなく事前条件違反になった
faithandbrave Aug 14, 2026
5351f0d
simd::partial_load : LWG Issueを記載
faithandbrave Aug 14, 2026
633c5da
フリースタンディング対応を記載
faithandbrave Aug 14, 2026
a3b6359
mapのコンストラクタ : LWG Issueを記載
faithandbrave Aug 14, 2026
073807f
span::first, last, subspan : 戻り値の型Rを仕様説明に導入
faithandbrave Aug 14, 2026
69d17fe
bitsetのコンストラクタ : C++26でテンプレートパラメータ制約を追加
faithandbrave Aug 14, 2026
0fdf781
ranges::partition, remove, remove_if : LWG Issueを記載
faithandbrave Aug 14, 2026
2b40671
optional::transform : LWG Issueを記載
faithandbrave Aug 14, 2026
31eff93
optional::emplace : 対応不要だったけどLWG Issueを記載
faithandbrave Aug 14, 2026
70bd943
condition_variable(_any)::wait_for, wait_until : C++26でduration, time…
faithandbrave Aug 14, 2026
f9b37b3
type_order : 特殊化を禁止
faithandbrave Aug 14, 2026
c7c930d
hive::erase_if : LWG Issueを記載
faithandbrave Aug 14, 2026
5ee73be
integral-constant-like : remove_constの代わりにremoe_cvrefが使用されるようになった
faithandbrave Aug 14, 2026
eadc278
optionalの比較演算子 : LWG Issueを記載
faithandbrave Aug 14, 2026
834e121
mdspan::layout_(left | right)_padded : 適格要件を緩和
faithandbrave Aug 14, 2026
00f3e30
bit_ceil : LWG Issueを追加
faithandbrave Aug 14, 2026
208d550
atomic_ref : LWG Issue対応としてrequired_alignmentの誤解を招く表現を変更
faithandbrave Aug 14, 2026
bcaf5b9
simd::basic_maskのコンストラクタ : LWG Issueを記載
faithandbrave Aug 14, 2026
8299b4b
flat_(multi)setのerase : LWG Issue対応として制約を追加
faithandbrave Aug 14, 2026
c1ced38
formatのenable_nonlocking_formatter_optimization : コンテナアダプタへの対応とremove…
faithandbrave Aug 14, 2026
a914e12
simd::basic_vecの推論補助 : サイズ型のstatic_cast
faithandbrave Aug 14, 2026
8688567
simd::permute : LWG Issueを記載
faithandbrave Aug 14, 2026
bc85494
simd::alignment : basic_maskを対象外にした
faithandbrave Aug 14, 2026
19e0a37
meta : compareをインクルード
faithandbrave Aug 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lang/cpp26/feature_test_macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`が、フリースタンディング機能に対応するマクロとしてマークされた(あわせて`<memory>`の`is_sufficiently_aligned`もフリースタンディング指定された)
- [LWG Issue 4550. Need new feature test macros for `<stdckdint.h>` and `<stdbit.h>`](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)
Expand Down
2 changes: 2 additions & 0 deletions reference/algorithm/ranges_partition.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<I>`制約が追加された(範囲版(4)にはあったが、イテレータ版で欠落していたものの修正)
2 changes: 2 additions & 0 deletions reference/algorithm/ranges_remove.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<I>`制約が追加された(範囲版(4)にはあったが、イテレータ版で欠落していたものの修正)
2 changes: 2 additions & 0 deletions reference/algorithm/ranges_remove_if.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<I>`制約が追加された(範囲版(4)にはあったが、イテレータ版で欠落していたものの修正)
2 changes: 2 additions & 0 deletions reference/algorithm/ranges_unique_copy.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`は同値関係であることが要求されるため動作は変わらない)
2 changes: 2 additions & 0 deletions reference/algorithm/unique_copy.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,3 +183,5 @@ OutputIterator unique_copy(InputIterator first, InputIterator last,
## 参照
- [P0202R3 Add Constexpr Modifiers to Functions in `<algorithm>` and `<utility>` 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`は同値関係であることが要求されるため動作は変わらない)
3 changes: 3 additions & 0 deletions reference/array.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
- [`<compare>`](compare.md) (C++20)


## フリースタンディング
このヘッダのほとんどの機能は、フリースタンディング処理系でも使用できる。ただし、例外を送出する一部の機能などは、フリースタンディング処理系では提供されない、または削除される。詳細は各機能のページを参照。

| 名前 | 説明 | 対応バージョン |
|-----------------------------|----------------------------|-------|
| [`array`](array/array.md) | 固定長配列(class template) | C++11 |
Expand Down
2 changes: 2 additions & 0 deletions reference/array/array/at.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ n番目の要素を参照する。


## 備考
この関数は、例外を送出しうるため、フリースタンディング処理系では削除される(フリースタンディング処理系では使用できない)。

`a.at(n)` は `*(a.`[`begin()`](begin.md) `+ n)` と同じ結果になる。


Expand Down
11 changes: 10 additions & 1 deletion reference/array/array/back.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 : 上記の特別な規定は削除され、他の要素アクセス関数と同様に、堅牢化された事前条件の違反として扱われる


## 例
Expand Down Expand Up @@ -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()`を呼び出したときの動作は未定義」という特別規定が削除され、他の要素アクセス関数と同様に堅牢化された事前条件の対象となった
12 changes: 11 additions & 1 deletion reference/array/array/front.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 : 上記の特別な規定は削除され、他の要素アクセス関数と同様に、堅牢化された事前条件の違反として扱われる


## 例
Expand Down Expand Up @@ -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()`を呼び出したときの動作は未定義」という特別規定が削除され、他の要素アクセス関数と同様に堅牢化された事前条件の対象となった
3 changes: 2 additions & 1 deletion reference/atomic.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
アトミック操作は、スレッド間でデータをやり取りするための最も基本的な同期プリミティブであり、
変数への不可分(atomic)な読み込みや書き込み、および読み書きを同時に行う操作(Read-Modify-Write operation)を提供する。

本ヘッダはフリースタンディング環境でも提供される。
## フリースタンディング
このヘッダのほとんどの機能は、フリースタンディング処理系でも使用できる。ただし、例外を送出する一部の機能などは、フリースタンディング処理系では提供されない、または削除される。詳細は各機能のページを参照。
フリースタンディング環境の場合、常にロックフリーな整数アトミック型のサポート、`atomic_signed_lock_free`や`atomic_unsigned_lock_free`の提供可否は処理系定義となる。

## 順序と一貫性
Expand Down
4 changes: 3 additions & 1 deletion reference/atomic/atomic_ref.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ C++26から、これらの特殊化はCV修飾された型に対しても行わ

`is_always_lock_free == true`の場合、このクラスのオブジェクトをシグナルハンドラー内で使用できる。

`required_alignment`について、ハードウェアは参照するオブジェクトに対して、型`T`のほかのオブジェクトよりも厳密なアライメントを持つことを要求できる。また、`atomic_ref`がロックフリーかどうかは、参照するオブジェクトのアライメントに依存する。たとえば[`std::complex`](/reference/complex/complex.md)`<double>`のロックフリー操作は`2 * alignof(double)`にアライメントされる場合にのみサポートされる
実装は、`atomic_ref<T>`の全てのオブジェクトに対する操作がロックフリーとなることを保証するために、`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)`<U>>`のものと同じである。これにより、CV修飾の違いによってアライメント要求やロックフリー保証が変わらないことが保証される。

Expand Down Expand Up @@ -238,5 +238,7 @@ int main()
- C++26でCV修飾されたテンプレート引数を受け取れるようになった
- [LWG Issue 4453. `atomic_ref<cv T>::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<double>`の例など)が、「実装はすべての操作がロックフリーとなるよう`required_alignment`を`alignof(T)`より大きく定義できる」という趣旨の注記へ修正された
- [LWG Issue 4450. `std::atomic_ref<T>::store` should be disabled for const `T`](https://cplusplus.github.io/LWG/issue4450)
- C++26で、`T`が`const`修飾されている場合に`store`をはじめとする値を変更するメンバ関数が制約により無効化されることが規定された
3 changes: 2 additions & 1 deletion reference/bit.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

`<bit>`ヘッダでは、ビット操作のための機能を定義する。

本ヘッダはフリースタンディング環境でも提供される。
## フリースタンディング
このヘッダは、フリースタンディング処理系でも使用できる。本ヘッダが提供する全ての機能がフリースタンディング処理系で使用可能である。

## 変換

Expand Down
7 changes: 7 additions & 0 deletions reference/bitset/bitset/op_constructor.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ constexpr explicit bitset(
- (5) : `'0'`と`'1'`の文字で構成される文字配列からビット列を構築する


## テンプレートパラメータ制約
- (5) :
- C++26 : [`is_array_v`](/reference/type_traits/is_array.md)`<CharT>`が`false`、[`is_trivially_copyable_v`](/reference/type_traits/is_trivially_copyable.md)`<CharT>`が`true`、[`is_standard_layout_v`](/reference/type_traits/is_standard_layout.md)`<CharT>`が`true`、かつ[`is_trivially_default_constructible_v`](/reference/type_traits/is_trivially_default_constructible.md)`<CharT>`が`true`であること


## 要件
- (3), (4) : `pos <= str.`[`size()`](/reference/string/basic_string/size.md)

Expand Down Expand Up @@ -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<CharT>`が`false`、`is_trivially_copyable_v`/`is_standard_layout_v`/`is_trivially_default_constructible_v`が`true`)が追加された。`CharT`が推論されるために不適当な型でもオーバーロード解決に参加してしまう問題を防ぐもの
4 changes: 4 additions & 0 deletions reference/cerrno.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

`<cerrno>`ヘッダでは、標準ライブラリで発生したエラーの状態を表すマクロ`errno`、およびエラー値を表す定数マクロが定義される。


## フリースタンディング
このヘッダは、フリースタンディング処理系でも使用できる。本ヘッダが提供する全ての機能がフリースタンディング処理系で使用可能である。

## エラーマクロ

| 名前 | 説明 | 対応バージョン |
Expand Down
3 changes: 2 additions & 1 deletion reference/cfloat.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

`<cfloat>`ヘッダでは、浮動小数点数に関連する定数値マクロを定義する。これは、C言語の標準ライブラリ`<float.h>`と同じである。

本ヘッダはフリースタンディング環境でも提供される。
## フリースタンディング
このヘッダは、フリースタンディング処理系でも使用できる。本ヘッダが提供する全ての機能がフリースタンディング処理系で使用可能である。

浮動小数点数 $x$ は以下のようにモデル化される。

Expand Down
4 changes: 4 additions & 0 deletions reference/charconv.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
- `#`による小数点以下の桁数指定はできない
- 16進数に`0x`は付けられない


## フリースタンディング
このヘッダの一部の機能が、フリースタンディング処理系でも使用できる。どの機能が使用できるかは各機能のページを参照。

## 文字列 ⇔ 数値変換関数

| 名前 | 説明 | 対応バージョン |
Expand Down
12 changes: 8 additions & 4 deletions reference/chrono/duration/op_constructor.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ duration(const duration&) = default; // (4)
- C++20 : [`is_convertible_v`](/reference/type_traits/is_convertible.md)`<const Rep2&, rep> == true`であること
- [`treat_as_floating_point`](/reference/chrono/treat_as_floating_point.md)`<rep>::value == true`もしくは[`treat_as_floating_point`](/reference/chrono/treat_as_floating_point.md)`<Rep2>::value == false`であること
- (3) :
- C++11 : [`treat_as_floating_point`](/reference/chrono/treat_as_floating_point.md)`<rep>::value == true`
- C++14 : 単位変換の結果としてオーバーフローせず、[`treat_as_floating_point`](/reference/chrono/treat_as_floating_point.md)`<rep>::value == true`
- もしくは、[`treat_as_floating_point`](/reference/chrono/treat_as_floating_point.md)`<rep>::value == false`かつ[`ratio_divide`](/reference/ratio/ratio_divide.md)`<Period2, period>::type::den == 1`
- [`is_convertible_v`](/reference/type_traits/is_convertible.md)`<const Rep2&, rep> == true`であること
- [`ratio_divide`](/reference/ratio/ratio_divide.md)`<typename Period2::type, period>`が有効な`ratio`の特殊化であること
- 次のいずれかを満たすこと:
- [`treat_as_floating_point`](/reference/chrono/treat_as_floating_point.md)`<rep>::value == true`である
- もしくは、[`ratio_divide`](/reference/ratio/ratio_divide.md)`<Period2, period>::den == 1`かつ[`treat_as_floating_point`](/reference/chrono/treat_as_floating_point.md)`<Rep2>::value == false`である
- これらの要求は、整数ベースの`duration`型間での変換の際に、暗黙に切り捨て誤差が起きるのを防ぐ。浮動小数点数型ベースの場合には、精度が下がれば小数点以下の数値になるだけなので問題ない。


Expand Down Expand Up @@ -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<const Rep2&, rep>`が`true`であることと`ratio_divide<typename Period2::type, period>`が有効な`ratio`の特殊化であることが明示された。この整理はC++26で規定されたが、実装は元々この意図どおりに制約していたため挙動は変わらない
Loading
Loading