class template
<memory>
std::uses_allocator
template <class T, class Alloc> struct uses_allocator;
Uses allocator
- integral_constant
- uses_allocator
Trait class that identifies whether T accepts an allocator convertible from Alloc.
It inherits from integral_constant as being either true_type or false_type, depending on whether
T accepts such allocator.The unspecialized definition for this template inherits from true_type if
T::allocator_type exists and is_convertible<Alloc,T::allocator_type>::value is not false.Classes that do not fill this requirement but still use an allocator shall specialize this template to derive from true_type if either:
- the last argument of a constructor has type Alloc.
- or, the first argument of a constructor has type allocator_arg_t and the second argument has type Alloc.
Template parameters
- T
- A type.
- Alloc
- An allocator type.
Member types
Inherited from integral_constant:| member type | definition |
|---|---|
| value_type | bool |
| type | either true_type or false_type |
Member constants
Inherited from integral_constant:| member constant | definition |
|---|---|
| value | either true or false |
Member functions
Inherited from integral_constant:- operator bool
- Returns value (public member function)
Example
|
|
Output:
See also
- allocator_traits
- Allocator traits (class template)