Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

Struct template uses_allocator

boost::container::uses_allocator

Synopsis

// In header: <boost/container/uses_allocator.hpp>

template<typename T, typename Allocator> 
struct uses_allocator {
};

Description

Remark: Automatically detects whether T has a nested allocator_type that is convertible from Allocator. Meets the BinaryTypeTrait requirements ([meta.rqmts] 20.4.1). A program may specialize this type to define uses_allocator<X>::value as true for a T of user-defined type if T does not have a nested allocator_type but is nonetheless constructible using the specified Allocator where either: the first argument of a constructor has type allocator_arg_t and the second argument has type Alloc or the last argument of a constructor has type Alloc.

Result: uses_allocator<T, Allocator>::value== true if a type T::allocator_type exists and either is_convertible<Alloc, T::allocator_type>::value != false or T::allocator_type is an alias erased_type. False otherwise.


PrevUpHomeNext