Skip to content

Commit

Permalink
allocator: C++20でのsize_typeとdifference_typeの扱いを修正
Browse files Browse the repository at this point in the history
* C++17で非推奨となったがC++20では非推奨が取り消されている模様
  https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0619r4.html#3.9
  • Loading branch information
kenichiice committed Jul 1, 2023
1 parent 0b73645 commit 592119b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 1 addition & 3 deletions lang/cpp20.md
Expand Up @@ -339,9 +339,7 @@ C++20とは、2020年中に改訂され、ISO/IEC 14882:2020で標準規格化


### 機能の削除
- C++11で[`allocator_traits`](/reference/memory/allocator_traits.md)クラスが導入されたことでC++17から非推奨化されていた、[`allocator`](/reference/memory/allocator.md)の以下のメンバを削除:
- `size_type`
- `difference_type`
- C++11で[`allocator_traits`](/reference/memory/allocator_traits.md)クラスが導入されたことでC++17から非推奨化されていた、[`allocator`](/reference/memory/allocator.md)の以下のメンバを削除。なお、`size_type`型と`difference_type`型の非推奨は取り消された。
- `pointer`
- `const_pointer`
- `reference`
Expand Down
5 changes: 3 additions & 2 deletions reference/memory/allocator.md
Expand Up @@ -56,8 +56,8 @@ C++11から:
|-------------------|----------------------------------------------|-------|
| `value_type` | 要素の型 `T` | |
| `propagate_on_container_move_assignment` | コンテナのムーブ代入時に、アロケータの状態を伝播するか。 [`true_type`](/reference/type_traits/true_type.md) | C++14 |
| `size_type` | 要素数を表す符号なし整数型 `size_t` | C++17から非推奨<br/> C++20で削除 |
| `difference_type` | ポインタの差を表す符号付き整数型 `ptrdiff_t` | C++17から非推奨<br/> C++20で削除 |
| `size_type` | 要素数を表す符号なし整数型 `size_t` | |
| `difference_type` | ポインタの差を表す符号付き整数型 `ptrdiff_t` | |
| `pointer` | 要素のポインタ型 `T*` | C++17から非推奨<br/> C++20で削除 |
| `const_pointer` | 読み取り専用の要素のポインタ型 `const T*` | C++17から非推奨<br/> C++20で削除 |
| `reference` | 要素の参照型 `T&` | C++17から非推奨<br/> C++20で削除 |
Expand All @@ -77,6 +77,7 @@ C++11から:
## 非推奨・削除の詳細
C++17から`void`の特殊化版が非推奨となり、C++20で削除された。代わりに[`std::allocator_traits`](allocator_traits.md)クラスの`rebind`機能を使用すること。

メンバ型の`size_type``difference_type`は、C++17で非推奨となったがC++20で非推奨が取り消された。

##
```cpp example
Expand Down

0 comments on commit 592119b

Please sign in to comment.