[allocator.uses.trait]

# 20 Memory management library [[mem]](./#mem)

## 20.2 Memory [[memory]](memory#allocator.uses.trait)

### 20.2.8 uses_allocator [[allocator.uses]](allocator.uses#trait)

#### 20.2.8.1 uses_allocator trait [allocator.uses.trait]

[ð](#lib:uses_allocator)

`template<class T, class Alloc> struct uses_allocator;
`

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/memory.tex#L1288)

*Remarks*: Automatically detects whether T has a nested allocator_type that
is convertible from Alloc[.](#1.sentence-1)

Meets the [*Cpp17BinaryTypeTrait*](meta.rqmts#:Cpp17BinaryTypeTrait "21.3.2 Requirements [meta.rqmts]") requirements ([[meta.rqmts]](meta.rqmts "21.3.2 Requirements"))[.](#1.sentence-2)

The implementation shall provide a definition that is
derived from true_type if the [*qualified-id*](expr.prim.id.qual#nt:qualified-id "7.5.5.3 Qualified names [expr.prim.id.qual]") T​::​allocator_type is valid and denotes a type ([[temp.deduct]](temp.deduct "13.10.3 Template argument deduction")) andis_convertible_v<Alloc, T​::​allocator_type> != false, otherwise it shall be
derived from false_type[.](#1.sentence-3)

A program may specialize this template to derive fromtrue_type for a program-defined type T that does not have a nestedallocator_type but nonetheless can be constructed with an allocator where
either:

- [(1.1)](#1.1)

the first argument of a constructor has type allocator_arg_t and the
second argument has type Alloc or

- [(1.2)](#1.2)

the last argument of a constructor has type Alloc[.](#1.sentence-4)
