Skip to content

Commit dde880f

Browse files
committed
<memory> : allocate_at_leastの仕様に取り込まれた文面が提案文書とちがっていたのを修正 #1053
1 parent 4c68758 commit dde880f

File tree

6 files changed

+16
-18
lines changed

6 files changed

+16
-18
lines changed

lang/cpp23.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ C++23とは、2023年中に改訂される予定の、C++バージョンの通
130130
- `auto v = std::vector(v, alloc);`のようなアロケータ引数をともなう場合のクラステンプレートのテンプレート引数推論が動作しなかったため、各コンテナクラスのコンストラクタにおけるアロケータパラメータの型を`const Allocator&`から`const` [`std::type_identity_t`](/reference/type_traits/type_identity.md)`<Allocator>&`に修正
131131
- N要素のメモリアロケート時にアロケータが実際にどれくらいのメモリを確保したかを得られるインタフェースとして、
132132
- [`std::allocator`](/reference/memory/allocator.md)クラスに、[`allocate_at_least()`](/reference/memory/allocator/allocate_at_least.md)メンバ関数を追加
133-
- [`std::allocate_at_least()`](/reference/memory/allocate_at_least.md)関数を追加
133+
- [`std::allocator_traits`](/reference/memory/allocator_traits.md)クラスに、[`allocate_at_least()`](/reference/memory/allocator_traits/allocate_at_least.md)関数を追加
134134
- [`std::pair`](/reference/utility/pair.md)の転送コンストラクタにデフォルトテンプレート引数を追加することで、`{}`のような型推論ができない引数を渡した場合でも完全転送が行われるよう修正
135135
- 順序付き連想コンテナの要素削除の処理について、一時オブジェクトのコストを抑える拡張が行われた
136136
- [`std::map::erase()`](/reference/map/map/erase.md)

reference/memory.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
|--------------------------------------------------|--------------------------------------------|-------|
1515
| [`allocator`](memory/allocator.md) | メモリアロケータの標準実装(class template) | |
1616
| [`allocator_traits`](memory/allocator_traits.md) | アロケータクラスへの間接的なアクセス(class template) | C++11 |
17-
| [`allocation_result`](memory/allocation_result.md) | [`allocate_at_least()`](memory/allocate_at_least.md)関数の戻り値型 | C++23 |
18-
| [`allocate_at_least`](memory/allocate_at_least.md) | 指定した要素数以上のメモリを確保する | C++23 |
17+
| [`allocation_result`](memory/allocation_result.md) | [`allocate_at_least()`](memory/allocator/allocate_at_least.md)関数の戻り値型 | C++23 |
1918
| [`allocator_arg_t`](memory/allocator_arg_t.md) | アロケータを引数として渡す際の、オーバーロード解決のためのタグ(class) | C++11 |
2019
| [`allocator_arg`](memory/allocator_arg_t.md) | アロケータを引数として渡す際の、オーバーロード解決のためのタグ(constant value) | C++11 |
2120
| [`uses_allocator`](memory/uses_allocator.md) |`T`がアロケータを使用するか調べる | C++11 |

reference/memory/allocation_result.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66

77
```cpp
88
namespace std {
9-
template <class Pointer>
9+
template <class Pointer, class SizeType = std::size_t>
1010
struct allocation_result {
1111
Pointer ptr;
12-
std::size_t count;
12+
SizeType count;
1313
};
1414
}
1515
```
1616
1717
## 概要
18-
`std::allocation_result`は、[`std::allocate_at_least()`](allocate_at_least.md)関数の戻り値型であり、以下の要素をもつ:
18+
`std::allocation_result`は、[`allocate_at_least()`](/reference/memory/allocator/allocate_at_least.md)関数の戻り値型であり、以下の要素をもつ:
1919
2020
| 変数名 | 説明 |
2121
|---------|------|
@@ -34,7 +34,7 @@ namespace std {
3434
3535
3636
## 関連項目
37-
- [`std::allocate_at_least()`](allocate_at_least.md)
37+
- [`std::allocator_traits`](allocator_traits.md)`::`[`allocate_at_least()`](allocator_traits/allocate_at_least.md)
3838
- [`std::allocator`](allocator.md)`::`[`allocate_at_least()`](allocator/allocate_at_least.md)
3939
4040

reference/memory/allocator/allocate_at_least.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ allocation count:4 bytes:16
7979

8080
## 関連項目
8181
- [`std::allocation_result`](/reference/memory/allocation_result.md)
82-
- [`std::allocate_at_least()`](/reference/memory/allocate_at_least.md)
82+
- [`std::allocator_traits`](/reference/memory/allocator_traits.md)`::`[`allocate_at_least()`](/reference/memory/allocator_traits/allocate_at_least.md)
8383

8484

8585
## 参照

reference/memory/allocator_traits.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ namespace std {
2626
| 名前 | 説明 | 対応バージョン |
2727
|--------------------------------------------------|----------------------------------------------|-------|
2828
| [`allocate`](allocator_traits/allocate.md) | メモリを確保する | C++11 |
29+
| [`allocate_at_least`](allocator_traits/allocate_at_least.md) | 指定した要素数以上のメモリを確保する | C++23 |
2930
| [`deallocate`](allocator_traits/deallocate.md) | メモリを解放する | C++11 |
3031
| [`max_size`](allocator_traits/max_size.md) | 一度に確保可能なメモリの最大サイズを取得する | C++11 |
3132
| [`construct`](allocator_traits/construct.md) | 引数を元にインスタンスを構築する | C++11 |

reference/memory/allocate_at_least.md renamed to reference/memory/allocator_traits/allocate_at_least.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
# alloacte_at_least
22
* memory[meta header]
33
* std[meta namespace]
4+
* allocator_traits[meta class]
45
* function template[meta id-type]
56
* cpp23[meta cpp]
67

78
```cpp
8-
namespace std {
9-
template <class Allocator>
10-
[[nodiscard] constexpr
11-
allocation_result<typename allocator_traits<Allocator>::pointer>
12-
allocate_at_least(Allocator& a, size_t n); // (1) C++23
13-
}
9+
[[nodiscard] static constexpr
10+
allocation_result<pointer, size_type>
11+
allocate_at_least(Alloc& a, size_type n); // (1) C++23
1412
```
1513
* allocation_result[link /reference/memory/allocation_result.md]
16-
* allocator_traits[link /reference/memory/allocator_traits.md]
1714
1815
## 概要
1916
指定した要素数以上のメモリを確保する。
@@ -32,16 +29,17 @@ namespace std {
3229
3330
int main() {
3431
std::allocator<int> alloc;
32+
using traits = std::allocator_traits<std::allocator<int>>;
3533
36-
std::allocation_result<int*> r = std::allocate_at_least(alloc, 3);
34+
std::allocation_result<int*> r = traits::allocate_at_least(alloc, 3);
3735
std::cout << "allocation count:" << r.count
3836
<< " bytes:" << sizeof(int) * r.count
3937
<< std::endl;
4038
4139
alloc.deallocate(r.ptr, r.count);
4240
}
4341
```
44-
* std::allocate_at_least[color ff0000]
42+
* allocate_at_least[color ff0000]
4543
* std::allocator[link /reference/memory/allocator.md]
4644
* std::allocation_result[link /reference/memory/allocation_result.md]
4745
* alloc.deallocate[link /reference/memory/allocator/deallocate.md]
@@ -63,7 +61,7 @@ allocation count:4 bytes:16
6361

6462
## 関連項目
6563
- [`std::allocation_result`](/reference/memory/allocation_result.md)
66-
- [`std::allocator`](allocator.md)`::`[`allocate_at_least()`](allocator/allocate_at_least.md)
64+
- [`std::allocator`](/reference/memory/allocator.md)`::`[`allocate_at_least()`](/reference/memory/allocator/allocate_at_least.md)
6765

6866

6967
## 参照

0 commit comments

Comments
 (0)