This class is a C++03-compatible implementation of std::scoped_allocator_adaptor.
More...
|
| scoped_allocator_adaptor () |
| Effects: value-initializes the OuterAlloc base class and the inner allocator object. More...
|
|
| ~scoped_allocator_adaptor () |
|
| scoped_allocator_adaptor (const scoped_allocator_adaptor &other) |
| Effects: initializes each allocator within the adaptor with the corresponding allocator from other. More...
|
|
| scoped_allocator_adaptor (BOOST_RV_REF(scoped_allocator_adaptor) other) |
| Effects: move constructs each allocator within the adaptor with the corresponding allocator from other. More...
|
|
template<class OuterA2 > |
| scoped_allocator_adaptor (BOOST_FWD_REF(OuterA2) outerAlloc, const InnerAllocs &...innerAllocs) |
| Requires: OuterAlloc shall be constructible from OuterA2. More...
|
|
template<class OuterA2 > |
| scoped_allocator_adaptor (const scoped_allocator_adaptor< OuterA2, InnerAllocs... > &other) |
| Requires: OuterAlloc shall be constructible from OuterA2. More...
|
|
template<class OuterA2 > |
| scoped_allocator_adaptor (BOOST_RV_REF_BEG scoped_allocator_adaptor< OuterA2, InnerAllocs... > BOOST_RV_REF_END other) |
| Requires: OuterAlloc shall be constructible from OuterA2. More...
|
|
scoped_allocator_adaptor & | operator= (BOOST_COPY_ASSIGN_REF(scoped_allocator_adaptor) other) |
|
scoped_allocator_adaptor & | operator= (BOOST_RV_REF(scoped_allocator_adaptor) other) |
|
size_type | max_size () const BOOST_CONTAINER_NOEXCEPT |
| Returns: allocator_traits<OuterAlloc>::max_size(outer_allocator()) . More...
|
|
template<class T > |
void | destroy (T *p) BOOST_CONTAINER_NOEXCEPT |
| Effects: calls OUTERMOST_ALLOC_TRAITS(*this)::destroy(OUTERMOST(*this), p) . More...
|
|
pointer | allocate (size_type n) |
| Returns: allocator_traits<OuterAlloc>::allocate(outer_allocator(), n) . More...
|
|
pointer | allocate (size_type n, const_void_pointer hint) |
| Returns: allocator_traits<OuterAlloc>::allocate(outer_allocator(), n, hint) . More...
|
|
void | deallocate (pointer p, size_type n) |
| Effects: allocator_traits<OuterAlloc>::deallocate(outer_allocator(), p, n) . More...
|
|
base_type & | base () |
|
const base_type & | base () const |
|
template<typename T , class... Args> |
container_detail::enable_if_c
<!container_detail::is_pair< T >
::value, void >::type | construct (T *p, BOOST_FWD_REF(Args)...args) |
| Effects: 1) If uses_allocator<T, inner_allocator_type>::value is false calls OUTERMOST_ALLOC_TRAITS(*this)::construct (OUTERMOST(*this), p, std::forward<Args>(args)...) . More...
|
|
template<class T1 , class T2 > |
void | construct (std::pair< T1, T2 > *p) |
|
template<class T1 , class T2 > |
void | construct (container_detail::pair< T1, T2 > *p) |
|
template<class T1 , class T2 , class U , class V > |
void | construct (std::pair< T1, T2 > *p, BOOST_FWD_REF(U) x, BOOST_FWD_REF(V) y) |
|
template<class T1 , class T2 , class U , class V > |
void | construct (container_detail::pair< T1, T2 > *p, BOOST_FWD_REF(U) x, BOOST_FWD_REF(V) y) |
|
template<class T1 , class T2 , class U , class V > |
void | construct (std::pair< T1, T2 > *p, const std::pair< U, V > &x) |
|
template<class T1 , class T2 , class U , class V > |
void | construct (container_detail::pair< T1, T2 > *p, const container_detail::pair< U, V > &x) |
|
template<class T1 , class T2 , class U , class V > |
void | construct (std::pair< T1, T2 > *p, BOOST_RV_REF_BEG std::pair< U, V > BOOST_RV_REF_END x) |
|
template<class T1 , class T2 , class U , class V > |
void | construct (container_detail::pair< T1, T2 > *p, BOOST_RV_REF_BEG container_detail::pair< U, V > BOOST_RV_REF_END x) |
|
template<class OuterA2 > |
| scoped_allocator_adaptor (internal_type_t, BOOST_FWD_REF(OuterA2) outer, const inner_allocator_type &inner) |
|
void | swap (scoped_allocator_adaptor_base &r) |
|
inner_allocator_type & | inner_allocator () BOOST_CONTAINER_NOEXCEPT |
|
inner_allocator_type const & | inner_allocator () const BOOST_CONTAINER_NOEXCEPT |
|
outer_allocator_type & | outer_allocator () BOOST_CONTAINER_NOEXCEPT |
|
const outer_allocator_type & | outer_allocator () const BOOST_CONTAINER_NOEXCEPT |
|
scoped_allocator_type | select_on_container_copy_construction () const |
|
template<typename OuterAlloc, typename... InnerAllocs>
singleton boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >
This class is a C++03-compatible implementation of std::scoped_allocator_adaptor.
The class template scoped_allocator_adaptor is an allocator template that specifies the memory resource (the outer allocator) to be used by a container (as any other allocator does) and also specifies an inner allocator resource to be passed to the constructor of every element within the container.
This adaptor is instantiated with one outer and zero or more inner allocator types. If instantiated with only one allocator type, the inner allocator becomes the scoped_allocator_adaptor itself, thus using the same allocator resource for the container and every element within the container and, if the elements themselves are containers, each of their elements recursively. If instantiated with more than one allocator, the first allocator is the outer allocator for use by the container, the second allocator is passed to the constructors of the container's elements, and, if the elements themselves are containers, the third allocator is passed to the elements' elements, and so on. If containers are nested to a depth greater than the number of allocators, the last allocator is used repeatedly, as in the single-allocator case, for any remaining recursions.
[Note: The scoped_allocator_adaptor is derived from the outer allocator type so it can be substituted for the outer allocator type in most expressions. -end note]
In the construct member functions, OUTERMOST(x)
is x if x does not have an outer_allocator()
member function and OUTERMOST(x.outer_allocator())
otherwise; OUTERMOST_ALLOC_TRAITS(x)
is allocator_traits<decltype(OUTERMOST(x))>
.
[Note: OUTERMOST(x)
and OUTERMOST_ALLOC_TRAITS(x)
are recursive operations. It is incumbent upon the definition of outer_allocator()
to ensure that the recursion terminates. It will terminate for all instantiations of scoped_allocator_adaptor. -end note]
template<typename OuterAlloc, typename... InnerAllocs>
template<typename T , class... Args>
Effects: 1) If uses_allocator<T, inner_allocator_type>::value
is false calls OUTERMOST_ALLOC_TRAITS(*this)::construct (OUTERMOST(*this), p, std::forward<Args>(args)...)
.
2) Otherwise, if uses_allocator<T, inner_allocator_type>::value
is true and is_constructible<T, allocator_arg_t, inner_allocator_type, Args...>::value
is true, calls OUTERMOST_ALLOC_TRAITS(*this)::construct(OUTERMOST(*this), p, allocator_arg, inner_allocator(), std::forward<Args>(args)...)
.
[Note: In compilers without advanced decltype SFINAE support, is_constructible
can't be implemented so that condition will be replaced by constructible_with_allocator_prefix<T>::value. -end note]
3) Otherwise, if uses_allocator<T, inner_allocator_type>::value is true and is_constructible<T, Args..., inner_allocator_type>::value
is true, calls OUTERMOST_ALLOC_TRAITS(*this)::construct(OUTERMOST(*this), p, std::forward<Args>(args)..., inner_allocator())
.
[Note: In compilers without advanced decltype SFINAE support, is_constructible
can't be implemented so that condition will be replaced by constructible_with_allocator_suffix<T>::value
. -end note]
4) Otherwise, the program is ill-formed.
[Note: An error will result if uses_allocator
evaluates to true but the specific constructor does not take an allocator. This definition prevents a silent failure to pass an inner allocator to a contained element. -end note]