Skip to content

Commit 9f13e4f

Browse files
committed
flat_map : add uses_allocator (#1078)
1 parent afdc031 commit 9f13e4f

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

reference/flat_map/flat_map.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,14 @@ namespace std {
152152
| [`(deduction_guide)`](flat_map/op_deduction_guide.md.nolink) | クラステンプレートの推論補助 | C++23 |
153153
154154
155+
## その他
156+
157+
| 名前 | 説明 | 対応バージョン |
158+
|------|------|----------------|
159+
| [`uses_allocator`](flat_map/uses_allocator.md) | `flat_map`による特殊化 | C++23 |
160+
161+
162+
155163
## 例
156164
### 基本的な使い方
157165
```cpp example
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# uses_allocator
2+
* flat_map[meta header]
3+
* std[meta namespace]
4+
* class template[meta id-type]
5+
* cpp23[meta cpp]
6+
7+
```cpp
8+
namespace std {
9+
template <class Key, class T, class Compare, class KeyContainer, class MappedContainer,
10+
class Alloc>
11+
struct uses_allocator<flat_map<Key, T, Compare, KeyContainer, MappedContainer>,
12+
Alloc>
13+
: bool_constant<uses_allocator_v<KeyContainer, Alloc> &&
14+
uses_allocator_v<MappedContainer, Alloc>> { };
15+
}
16+
```
17+
* bool_constant[link /reference/type_traits/bool_constant.md]
18+
19+
## 概要
20+
`uses_allocator`の、`flat_map`に対する特殊化。
21+
22+
アロケータを指定する`flat_map`のコンストラクタにおいて、指定されたアロケータと、`KeyContainer`および`MappedContainer`が合致するかをチェックするのに使われる。
23+
24+
25+
## 例
26+
```cpp
27+
#include <flat_map>
28+
#include <iostream>
29+
30+
int main()
31+
{
32+
using fm_t = std::flat_map<int, int>;
33+
34+
std::cout << std::uses_allocator<fm_t, std::allocator<int>>::value << std::endl;
35+
}
36+
```
37+
* std::uses_allocator[color ff0000]
38+
* std::allocator[link /reference/memory/allocator.md]
39+
40+
### 出力
41+
```cpp
42+
1
43+
```
44+
45+
## バージョン
46+
### 言語
47+
- C++23
48+
49+
### 処理系
50+
- [Clang](/implementation.md#clang): ??
51+
- [GCC](/implementation.md#gcc): ??
52+
- [Visual C++](/implementation.md#visual_cpp): ??
53+
54+
55+
## 参照

0 commit comments

Comments
 (0)