Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion reference/atomic/atomic_flag_init.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,6 @@ false

## 参照
- [P0883R2 Fixing Atomic Initialization, Rev2](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p0883r2.pdf)
- [LWG Issue 3659. Consider `ATOMIC_FLAG_INIT` undeprecation](http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#3659)
- C++20で、デフォルトコンストラクタが値初期化を行うようになり、あわせてこのマクロが非推奨とされた
- [LWG Issue 3659. Consider `ATOMIC_FLAG_INIT` undeprecation](https://cplusplus.github.io/LWG/issue3659)
- C++23で、一部のプラットフォームでは静的初期化のために必要であることから、このマクロの非推奨が解除された
2 changes: 2 additions & 0 deletions reference/expected/expected.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,3 +212,5 @@ int main()
## 参照
- [P0323R12 std::expected](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p0323r12.html)
- [P2505R5 Monadic Functions for `std::expected`](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2505r5.html)
- [LWG Issue 3703. Missing requirements for `expected<T, E>` requires `is_void<T>`](https://cplusplus.github.io/LWG/issue3703)
- C++23で、`expected<void, E>`部分特殊化にも型`E`に対する適格要件が明記された
2 changes: 2 additions & 0 deletions reference/expected/expected.void/op_assign.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ int main()

## 参照
- [P0323R12 std::expected](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p0323r12.html)
- [LWG Issue 3687. `expected<cv void, E>` move constructor should move](https://cplusplus.github.io/LWG/issue3687)
- C++23で、ムーブ代入演算子(2)で両者がエラー値を保持する場合に、エラー値がコピーではなくムーブされるよう修正された
- [LWG Issue 4025. Move assignment operator of `std::expected<cv void, E>` should not be conditionally deleted](https://cplusplus.github.io/LWG/issue4025)
- C++26で、ムーブ代入演算子(2)が条件付きでdelete定義されるのではなく、テンプレートパラメータ制約によってオーバーロード解決から除外されるよう修正された
- [LWG Issue 4026. Assignment operators of `std::expected` should propagate triviality](https://cplusplus.github.io/LWG/issue4026)
Expand Down
23 changes: 18 additions & 5 deletions reference/exposition-only/decay-copy.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@

```cpp
template<class T>
constexpr decay_t<T> decay-copy(T&& v) noexcept(is_nothrow_convertible_v<T, decay_t<T>>)
{
return std::forward<T>(v);
}
constexpr decay_t<T> decay-copy(T&& v)
noexcept(is_nothrow_convertible_v<T, decay_t<T>>); // (1) C++20
template<class T>
requires convertible_to<T, decay_t<T>>
constexpr decay_t<T> decay-copy(T&& v)
noexcept(is_nothrow_convertible_v<T, decay_t<T>>); // (1) C++23
```
* decay-copy[italic]
* forward[link /reference/utility/forward.md]
* convertible_to[link /reference/concepts/convertible_to.md]
* is_nothrow_convertible_v[link /reference/type_traits/is_nothrow_convertible.md]

## 概要
Expand All @@ -32,6 +34,15 @@ int g = 0;
int f(){ return g; }
```

## 効果
以下と等価である:

```cpp
return std::forward<T>(v);
```
* forward[link /reference/utility/forward.md]


## 戻り値
式`decay-copy(v)`の値は次のようになる。

Expand All @@ -47,3 +58,5 @@ int f(){ return g; }
## 参照
- [N4861 16.4.2.1 Exposition-only functions](https://timsong-cpp.github.io/cppwp/n4861/expos.only.func)
- [N3255 C++ Decay Copy](http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2011/n3255.html) 実際の関数として提案しているが、採用には至っていない。
- [LWG Issue 3724. decay-copy should be constrained](https://cplusplus.github.io/LWG/issue3724)
- C++23で、`decay-copy`に`convertible_to<T, decay_t<T>>`制約が追加され、変換できない型に対してSFINAEフレンドリー(ill-formed)になった
30 changes: 27 additions & 3 deletions reference/filesystem/directory_iterator/op_equal.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,34 @@

```cpp
namespace std::filesystem {
bool operator==(const directory_iterator& a, const directory_iterator& b) noexcept;
bool operator==(const directory_iterator& a, const directory_iterator& b) noexcept; // (1) C++17

class directory_iterator {
public:
bool operator==(default_sentinel_t) const noexcept; // (2) C++23
};
}
```
* default_sentinel_t[link /reference/iterator/default_sentinel_t.md]

## 概要
2つの`directory_iterator`オブジェクトが等値かを判定する。
`directory_iterator`オブジェクトが等値かを判定する。

- (1) : 2つの`directory_iterator`オブジェクトを等値比較する。
- (2) : `directory_iterator`オブジェクトが終端(ディレクトリの末尾)に到達しているかを判定する。


## 戻り値
2つの`directory_iterator`オブジェクトが等値である場合は`true`、そうでなければ`false`を返す。
- (1) : 2つの`directory_iterator`オブジェクトが等値である場合は`true`、そうでなければ`false`を返す。
- (2) : `*this == directory_iterator()`と等価。すなわち、イテレータが終端を指していれば`true`、そうでなければ`false`を返す。


## 例
```cpp example
#include <cassert>
#include <filesystem>
#include <fstream>
#include <iterator>

namespace fs = std::filesystem;

Expand All @@ -33,14 +44,22 @@ int main()

fs::directory_iterator a{"dir"};
fs::directory_iterator b = a;

// (1) 2つのイテレータの等値比較
assert(a == b);

++b;

// (1) デフォルト構築したイテレータ(終端)との比較
fs::directory_iterator end{};
assert(b == end);

// (2) default_sentinelとの比較で終端を判定する (C++23)
assert(b == std::default_sentinel);
}
```
* fs::create_directory[link /reference/filesystem/create_directory.md]
* std::default_sentinel[link /reference/iterator/default_sentinel.md.nolink]

### 出力
```
Expand All @@ -54,3 +73,8 @@ int main()
- [Clang](/implementation.md#clang): 7.0 [mark verified]
- [GCC](/implementation.md#gcc): 8.1 [mark verified]
- [Visual C++](/implementation.md#visual_cpp):


## 参照
- [LWG Issue 3719. Directory iterators should be usable with default sentinel](https://cplusplus.github.io/LWG/issue3719)
- C++23で、`default_sentinel_t`との等値比較演算子(2)が追加された
30 changes: 27 additions & 3 deletions reference/filesystem/recursive_directory_iterator/op_equal.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,34 @@
```cpp
namespace std::filesystem {
bool operator==(const recursive_directory_iterator& a,
const recursive_directory_iterator& b) noexcept;
const recursive_directory_iterator& b) noexcept; // (1) C++17

class recursive_directory_iterator {
public:
bool operator==(default_sentinel_t) const noexcept; // (2) C++23
};
}
```
* default_sentinel_t[link /reference/iterator/default_sentinel_t.md]

## 概要
2つの`recursive_directory_iterator`オブジェクトが等値かを判定する。
`recursive_directory_iterator`オブジェクトが等値かを判定する。

- (1) : 2つの`recursive_directory_iterator`オブジェクトを等値比較する。
- (2) : `recursive_directory_iterator`オブジェクトが終端(ディレクトリの末尾)に到達しているかを判定する。


## 戻り値
2つの`recursive_directory_iterator`オブジェクトが等値である場合は`true`、そうでなければ`false`を返す。
- (1) : 2つの`recursive_directory_iterator`オブジェクトが等値である場合は`true`、そうでなければ`false`を返す。
- (2) : `*this == recursive_directory_iterator()`と等価。すなわち、イテレータが終端を指していれば`true`、そうでなければ`false`を返す。


## 例
```cpp example
#include <cassert>
#include <filesystem>
#include <fstream>
#include <iterator>

namespace fs = std::filesystem;

Expand All @@ -34,14 +45,22 @@ int main()

fs::recursive_directory_iterator a{"dir"};
fs::recursive_directory_iterator b = a;

// (1) 2つのイテレータの等値比較
assert(a == b);

++b;

// (1) デフォルト構築したイテレータ(終端)との比較
fs::recursive_directory_iterator end{};
assert(b == end);

// (2) default_sentinelとの比較で終端を判定する (C++23)
assert(b == std::default_sentinel);
}
```
* fs::create_directory[link /reference/filesystem/create_directory.md]
* std::default_sentinel[link /reference/iterator/default_sentinel.md.nolink]

### 出力
```
Expand All @@ -55,3 +74,8 @@ int main()
- [Clang](/implementation.md#clang): 7.0 [mark verified]
- [GCC](/implementation.md#gcc): 8.1 [mark verified]
- [Visual C++](/implementation.md#visual_cpp):


## 参照
- [LWG Issue 3719. Directory iterators should be usable with default sentinel](https://cplusplus.github.io/LWG/issue3719)
- C++23で、`default_sentinel_t`との等値比較演算子(2)が追加された
2 changes: 2 additions & 0 deletions reference/format/format.md
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,8 @@ wstring format(const locale& loc, wformat_string<Args...> fmt, const Args&... ar
- C++26から非ロケール版が`constexpr`に対応した
- [LWG Issue 3720. Restrict the valid types of _arg-id_ for _width_ and _precision_ in _std-format-spec_](https://cplusplus.github.io/LWG/issue3720)
- C++23で、幅・精度を動的引数で指定する場合、その引数の型が標準の符号付き/符号なし整数型に制限された(`bool`や文字型は指定できなくなった)
- [LWG Issue 3721. Allow an _arg-id_ with a value of zero for _width_ in _std-format-spec_](https://cplusplus.github.io/LWG/issue3721)
- C++23で、幅を動的引数で指定する場合に値0を許可するようになった(精度と要件を統一し、負値のみ例外となる)
- [LWG Issue 4090. Underspecified use of locale facets for locale-dependent `std::format`](https://cplusplus.github.io/LWG/issue4090)
- C++26で、`L`オプション指定時にロケール依存の置換で使用されるファセットが`numpunct`(`grouping`/`thousands_sep`/`decimal_point`/`truename`/`falsename`)であることが明確化された
- [LWG Issue 4522. Clarify that `std::format` transcodes for `std::wformat_strings`](https://cplusplus.github.io/LWG/issue4522)
Expand Down
2 changes: 2 additions & 0 deletions reference/format/formatter.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,8 @@ int main()
- [P2286R8 Formatting Ranges](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2286r8.html)
- [P2585R1 Improve default container formatting](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2585r1.html)
- C++23から、Range・コンテナ、`pair`、`tuple`のフォーマット出力、および文字・文字列のデバッグ指定 (`"?"`) が追加された
- [LWG Issue 3701. Make `formatter<remove_cvref_t<const charT[N]>, charT>` requirement explicit](https://cplusplus.github.io/LWG/issue3701)
- C++23で、有効な標準特殊化の一覧に`formatter<charT[N], charT>`が明示的に追加された
- [LWG Issue 3833. Remove specialization `template<size_t N> struct formatter<const charT[N], charT>`](https://cplusplus.github.io/LWG/issue3833)
- C++23で、`formatter`がCV修飾のないオブジェクト型に対してのみ特殊化される設計と矛盾するため、`formatter<const charT[N], charT>`の特殊化が有効な標準特殊化の一覧から削除された
- [LWG Issue 3944. Formatters converting sequences of `char` to sequences of `wchar_t`](https://cplusplus.github.io/LWG/issue3944)
Expand Down
10 changes: 7 additions & 3 deletions reference/functional/function/op_deduction_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ namespace std {
- (2) :
- `&F::operator()`は評価されないオペランドとして扱われ、以下のいずれかの場合に適格である:
- C++17 :
- `decltype(&F::operator())`は、型`G`があるとして、`R(G::*)(A...) cv &(opt) noexcept(opt)`形式もしくは`R(*)(G cv ref(opt), A...) noexcept(opt)`形式であること
- `decltype(&F::operator())`は、型`G`があるとして、`R(G::*)(A...) cv &(opt) noexcept(opt)`形式であること
- C++23 :
- `decltype(&F::operator())`は、型`G`があるとして、`R(G::*)(A...) cv &(opt) noexcept(opt)`形式もしくは`R(*)(G, A...) noexcept(opt)`形式であること
- C++26 :
- `F::operator()`が非静的メンバ関数であり、`decltype(&F::operator())`は、型`G`があるとして、`R(G::*)(A...) cv &(opt) noexcept(opt)`形式もしくは`R(*)(G cv ref(opt), A...) noexcept(opt)`形式であること
- `F::operator()`静的メンバ関数であり、`decltype(&F::operator())`は`R(*)(A...) noexcept(opt)`形式であること
- `F::operator()`が非静的メンバ関数であり、`decltype(&F::operator())`は、型`G`があるとして、`R(G::*)(A...) cv &(opt) noexcept(opt)`形式もしくは`R(*)(G, A...) noexcept(opt)`形式であること
- `F::operator()`が静的メンバ関数であり、`decltype(&F::operator())`は`R(*)(A...) noexcept(opt)`形式であること


## 例
Expand Down Expand Up @@ -94,3 +96,5 @@ int main()

## 参照
- [LWG issue 3117. Missing `packaged_task` deduction guides](https://wg21.cmeerw.net/lwg/issue3117)
- [LWG Issue 3617. `function`/`packaged_task` deduction guides and deducing `this`](https://cplusplus.github.io/LWG/issue3617)
- C++23で、明示的オブジェクトパラメータ(deducing this)をもつ関数呼び出し演算子に対応するため、推論補助の制約に`R(*)(G, A...) noexcept(opt)`形式が追加された
10 changes: 7 additions & 3 deletions reference/future/packaged_task/op_deduction_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ namespace std {
## テンプレートパラメータ制約
- (2) :
- `&F::operator()`は評価されないオペランドとして扱われ、以下のいずれかの場合に適格である:
- C++17 :
- C++20 :
- `decltype(&F::operator())`は、型`G`があるとして、`R(G::*)(A...) cv &(opt) noexcept(opt)`形式であること
- C++23 :
- `decltype(&F::operator())`は、型`G`があるとして、`R(G::*)(A...) cv &(opt) noexcept(opt)`形式もしくは`R(*)(G, A...) noexcept(opt)`形式であること
- C++26 :
- `F::operator()`が非静的メンバ関数であり、`decltype(&F::operator())`は、型`G`があるとして、`R(G::*)(A...) cv &(opt) noexcept(opt)`形式もしくは`R(*)(G cv ref(opt), A...) noexcept(opt)`形式であること
- `F::operator()`静的メンバ関数であり、`decltype(&F::operator())`は`R(*)(A...) noexcept(opt)`形式であること
- `F::operator()`が非静的メンバ関数であり、`decltype(&F::operator())`は、型`G`があるとして、`R(G::*)(A...) cv &(opt) noexcept(opt)`形式もしくは`R(*)(G, A...) noexcept(opt)`形式であること
- `F::operator()`が静的メンバ関数であり、`decltype(&F::operator())`は`R(*)(A...) noexcept(opt)`形式であること


## 例
Expand Down Expand Up @@ -93,3 +95,5 @@ int main()

## 参照
- [P0433R2 Toward a resolution of US7 and US14: Integrating template deduction for class templates into the standard library](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0433r2.html)
- [LWG Issue 3617. `function`/`packaged_task` deduction guides and deducing `this`](https://cplusplus.github.io/LWG/issue3617)
- C++23で、明示的オブジェクトパラメータ(deducing this)をもつ関数呼び出し演算子に対応するため、推論補助の制約に`R(*)(G, A...) noexcept(opt)`形式が追加された
4 changes: 3 additions & 1 deletion reference/iterator/common_iterator/op_arrow.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* cpp20[meta cpp]

```cpp
decltype(auto) operator->() const requires see below;
auto operator->() const requires see below;
```

## 概要
Expand Down Expand Up @@ -68,5 +68,7 @@ indirectly_readable<const I> &&

## 参照
- [P0896R4 The One Ranges Proposal (was Merging the Ranges TS)](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0896r4.pdf)
- [LWG Issue 3672. `common_iterator::operator->()` should return by value](https://cplusplus.github.io/LWG/issue3672)
- C++23で、戻り値の型が`decltype(auto)`から`auto`(値返し)に変更された
- [P3697R1 Minor additions to C++26 standard library hardening](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3697r1.html)
- [P3878R1 Standard library hardening should not use the 'observe' semantic](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3878r1.html)
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,4 @@ true
## 参照

- [LWG Issue 3683. `operator==` for `polymorphic_allocator` cannot deduce template argument in common cases](https://cplusplus.github.io/LWG/issue3683)
- C++23で、hidden friendとして同次の`operator==`(1)が追加され、`memory_resource*`等からの変換を伴う比較ができるようになった
2 changes: 2 additions & 0 deletions reference/ranges/chunk_view/end.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,5 @@ int main() {

## 参照
- [N4950 26.7.29 Chunk view](https://timsong-cpp.github.io/cppwp/n4950/range.chunk)
- [LWG Issue 3710. The end of `chunk_view` for input ranges can be const](https://cplusplus.github.io/LWG/issue3710)
- C++23で、input rangeに対する`end()`(1)に`const`修飾が付き、const object からも番兵を取得できるようになった
26 changes: 10 additions & 16 deletions reference/ranges/chunk_view/op_constructor.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,25 @@
* cpp23[meta cpp]

```cpp
chunk_view()
requires default_initializable<V> = default; // (1) C++23

constexpr explicit
chunk_view(V base, range_difference_t<V> n); // (2) C++23
chunk_view(V base, range_difference_t<V> n); // (1) C++23
```

## 概要

`chunk_view`オブジェクトを構築する。

- (1) : デフォルトコンストラクタ。元となるRangeを値初期化する。
- (2) : 元となるRangeと分割数を受け取るコンストラクタ。
- (1) : 元となるRangeと分割数を受け取るコンストラクタ。

## 効果

- (1) : `base_`と`n_`を値初期化する。
- (2) : `base_(std::move(base))`、`n_(n)`で初期化する。
- (1) : `base_(std::move(base))`、`n_(n)`で初期化する。

ここで、`base_`は元となるRangeを保持するメンバ変数、`n_`は分割する要素数を保持するメンバ変数である。

## 事前条件

- (2) : `n > 0`
- (1) : `n > 0`

## 例
```cpp example
Expand All @@ -39,14 +34,11 @@ chunk_view(V base, range_difference_t<V> n); // (2) C++23

int main() {
std::vector<int> v = {1, 2, 3, 4, 5, 6, 7, 8};

// デフォルトコンストラクタ
std::ranges::chunk_view<std::views::all_t<std::vector<int>>> cv1{};


// 元となるRangeと分割数を指定
std::ranges::chunk_view cv2{v, 3};
std::println("{}", cv2);
std::ranges::chunk_view cv{v, 3};

std::println("{}", cv);
}
```
* std::ranges::chunk_view[color ff0000]
Expand All @@ -67,3 +59,5 @@ int main() {

## 参照
- [N4950 26.7.29 Chunk view](https://timsong-cpp.github.io/cppwp/n4950/range.chunk)
- [LWG Issue 3712. chunk_view and slide_view should not be default_initializable](https://cplusplus.github.io/LWG/issue3712)
- C++23で、事前条件`n > 0`を満たせないデフォルトコンストラクタが削除された
2 changes: 2 additions & 0 deletions reference/ranges/iota_view/iterator.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,5 +205,7 @@ namespace std::ranges {
## 参照
- [N4861 24 Ranges library](https://timsong-cpp.github.io/cppwp/n4861/ranges)
- [C++20 ranges](https://techbookfest.org/product/5134506308665344)
- [LWG Issue 3670. Cpp17InputIterators don't have integer-class difference types](https://cplusplus.github.io/LWG/issue3670)
- C++23で、`iterator_category`は`iota_diff_t<W>`が整数型のときにのみ`input_iterator_tag`として定義されるよう条件が追加された
- [P3059R2 Making user-defined constructors of view iterators/sentinels private](https://open-std.org/jtc1/sc22/wg21/docs/papers/2026/p3059r2.html)
- C++26で、ユーザー定義のコンストラクタを`public`から`private`に移動
Loading
Loading