Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs > Singleton Reference

This class is a C++03-compatible implementation of std::scoped_allocator_adaptor. More...

#include <scoped_allocator_fwd.hpp>

Inheritance diagram for boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >:
Collaboration diagram for boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >:

Classes

struct  rebind
 Type: Rebinds scoped allocator to typedef scoped_allocator_adaptor < typename outer_traits_type::template portable_rebind_alloc<U>::type , InnerAllocs... More...
 

Public Types

typedef
container_detail::scoped_allocator_adaptor_base
< OuterAlloc, InnerAllocs... > 
base_type
 
typedef base_type::internal_type_t internal_type_t
 
typedef OuterAlloc outer_allocator_type
 
typedef allocator_traits
< OuterAlloc > 
outer_traits_type
 Type: For exposition only. More...
 
typedef
base_type::inner_allocator_type 
inner_allocator_type
 Type: scoped_allocator_adaptor<OuterAlloc> if sizeof...(InnerAllocs) is zero; otherwise, scoped_allocator_adaptor<InnerAllocs...>. More...
 
typedef allocator_traits
< inner_allocator_type
inner_traits_type
 
typedef
outer_traits_type::value_type 
value_type
 
typedef
outer_traits_type::size_type 
size_type
 
typedef
outer_traits_type::difference_type 
difference_type
 
typedef outer_traits_type::pointer pointer
 
typedef
outer_traits_type::const_pointer 
const_pointer
 
typedef
outer_traits_type::void_pointer 
void_pointer
 
typedef
outer_traits_type::const_void_pointer 
const_void_pointer
 
typedef
base_type::propagate_on_container_copy_assignment 
propagate_on_container_copy_assignment
 Type: true_type if allocator_traits<Allocator>::propagate_on_container_copy_assignment::value is true for any Allocator in the set of OuterAlloc and InnerAllocs...; otherwise, false_type. More...
 
typedef
base_type::propagate_on_container_move_assignment 
propagate_on_container_move_assignment
 Type: true_type if allocator_traits<Allocator>::propagate_on_container_move_assignment::value is true for any Allocator in the set of OuterAlloc and InnerAllocs...; otherwise, false_type. More...
 
typedef
base_type::propagate_on_container_swap 
propagate_on_container_swap
 Type: true_type if allocator_traits<Allocator>::propagate_on_container_swap::value is true for any Allocator in the set of OuterAlloc and InnerAllocs...; otherwise, false_type. More...
 
typedef
scoped_allocator_adaptor
< OuterAlloc, InnerAllocs...> 
scoped_allocator_type
 

Public Member Functions

 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_adaptoroperator= (BOOST_COPY_ASSIGN_REF(scoped_allocator_adaptor) other)
 
scoped_allocator_adaptoroperator= (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_typebase ()
 
const base_typebase () 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_typeinner_allocator () BOOST_CONTAINER_NOEXCEPT
 
inner_allocator_type const & inner_allocator () const BOOST_CONTAINER_NOEXCEPT
 
outer_allocator_typeouter_allocator () BOOST_CONTAINER_NOEXCEPT
 
const outer_allocator_typeouter_allocator () const BOOST_CONTAINER_NOEXCEPT
 
scoped_allocator_type select_on_container_copy_construction () const
 

Detailed Description

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]

Member Typedef Documentation

template<typename OuterAlloc, typename... InnerAllocs>
typedef container_detail::scoped_allocator_adaptor_base<OuterAlloc , InnerAllocs... > boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >::base_type
template<typename OuterAlloc, typename... InnerAllocs>
typedef outer_traits_type::const_pointer boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >::const_pointer
template<typename OuterAlloc, typename... InnerAllocs>
typedef outer_traits_type::const_void_pointer boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >::const_void_pointer
template<typename OuterAlloc, typename... InnerAllocs>
typedef outer_traits_type::difference_type boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >::difference_type
template<typename OuterAlloc, typename... InnerAllocs>
typedef base_type::inner_allocator_type boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >::inner_allocator_type

Type: scoped_allocator_adaptor<OuterAlloc> if sizeof...(InnerAllocs) is zero; otherwise, scoped_allocator_adaptor<InnerAllocs...>.

template<typename OuterAlloc, typename... InnerAllocs>
typedef allocator_traits<inner_allocator_type> boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >::inner_traits_type
template<typename OuterAlloc, typename... InnerAllocs>
typedef base_type::internal_type_t boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >::internal_type_t
template<typename OuterAlloc, typename... InnerAllocs>
typedef OuterAlloc boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >::outer_allocator_type
template<typename OuterAlloc, typename... InnerAllocs>
typedef allocator_traits<OuterAlloc> boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >::outer_traits_type

Type: For exposition only.

template<typename OuterAlloc, typename... InnerAllocs>
typedef outer_traits_type::pointer boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >::pointer
template<typename OuterAlloc, typename... InnerAllocs>
typedef base_type:: propagate_on_container_copy_assignment boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >::propagate_on_container_copy_assignment

Type: true_type if allocator_traits<Allocator>::propagate_on_container_copy_assignment::value is true for any Allocator in the set of OuterAlloc and InnerAllocs...; otherwise, false_type.

template<typename OuterAlloc, typename... InnerAllocs>
typedef base_type:: propagate_on_container_move_assignment boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >::propagate_on_container_move_assignment

Type: true_type if allocator_traits<Allocator>::propagate_on_container_move_assignment::value is true for any Allocator in the set of OuterAlloc and InnerAllocs...; otherwise, false_type.

template<typename OuterAlloc, typename... InnerAllocs>
typedef base_type:: propagate_on_container_swap boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >::propagate_on_container_swap

Type: true_type if allocator_traits<Allocator>::propagate_on_container_swap::value is true for any Allocator in the set of OuterAlloc and InnerAllocs...; otherwise, false_type.

typedef scoped_allocator_adaptor<OuterAlloc, InnerAllocs...> boost::container::container_detail::scoped_allocator_adaptor_base< OuterAlloc, InnerAllocs >::scoped_allocator_type
inherited
template<typename OuterAlloc, typename... InnerAllocs>
typedef outer_traits_type::size_type boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >::size_type
template<typename OuterAlloc, typename... InnerAllocs>
typedef outer_traits_type::value_type boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >::value_type
template<typename OuterAlloc, typename... InnerAllocs>
typedef outer_traits_type::void_pointer boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >::void_pointer

Constructor & Destructor Documentation

template<typename OuterAlloc, typename... InnerAllocs>
boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >::scoped_allocator_adaptor ( )
inline

Effects: value-initializes the OuterAlloc base class and the inner allocator object.

template<typename OuterAlloc, typename... InnerAllocs>
boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >::~scoped_allocator_adaptor ( )
inline
template<typename OuterAlloc, typename... InnerAllocs>
boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >::scoped_allocator_adaptor ( const scoped_allocator_adaptor< OuterAlloc, InnerAllocs > &  other)
inline

Effects: initializes each allocator within the adaptor with the corresponding allocator from other.

template<typename OuterAlloc, typename... InnerAllocs>
boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >::scoped_allocator_adaptor ( BOOST_RV_REF(scoped_allocator_adaptor< OuterAlloc, InnerAllocs >)  other)
inline

Effects: move constructs each allocator within the adaptor with the corresponding allocator from other.

template<typename OuterAlloc, typename... InnerAllocs>
template<class OuterA2 >
boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >::scoped_allocator_adaptor ( BOOST_FWD_REF(OuterA2)  outerAlloc,
const InnerAllocs &...  innerAllocs 
)
inline

Requires: OuterAlloc shall be constructible from OuterA2.

Effects: initializes the OuterAlloc base class with boost::forward<OuterA2>(outerAlloc) and inner with innerAllocs...(hence recursively initializing each allocator within the adaptor with the corresponding allocator from the argument list).

template<typename OuterAlloc, typename... InnerAllocs>
template<class OuterA2 >
boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >::scoped_allocator_adaptor ( const scoped_allocator_adaptor< OuterA2, InnerAllocs... > &  other)
inline

Requires: OuterAlloc shall be constructible from OuterA2.

Effects: initializes each allocator within the adaptor with the corresponding allocator from other.

template<typename OuterAlloc, typename... InnerAllocs>
template<class OuterA2 >
boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >::scoped_allocator_adaptor ( BOOST_RV_REF_BEG scoped_allocator_adaptor< OuterA2, InnerAllocs... > BOOST_RV_REF_END  other)
inline

Requires: OuterAlloc shall be constructible from OuterA2.

Effects: initializes each allocator within the adaptor with the corresponding allocator rvalue from other.

template<typename OuterAlloc, typename... InnerAllocs>
template<class OuterA2 >
boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >::scoped_allocator_adaptor ( internal_type_t  ,
BOOST_FWD_REF(OuterA2)  outer,
const inner_allocator_type inner 
)
inline

Member Function Documentation

template<typename OuterAlloc, typename... InnerAllocs>
pointer boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >::allocate ( size_type  n)
inline

Returns: allocator_traits<OuterAlloc>::allocate(outer_allocator(), n).

template<typename OuterAlloc, typename... InnerAllocs>
pointer boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >::allocate ( size_type  n,
const_void_pointer  hint 
)
inline

Returns: allocator_traits<OuterAlloc>::allocate(outer_allocator(), n, hint).

template<typename OuterAlloc, typename... InnerAllocs>
base_type& boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >::base ( )
inline
template<typename OuterAlloc, typename... InnerAllocs>
const base_type& boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >::base ( ) const
inline
template<typename OuterAlloc, typename... InnerAllocs>
template<typename T , class... Args>
container_detail::enable_if_c<!container_detail::is_pair<T>::value, void>::type boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >::construct ( T p,
BOOST_FWD_REF(Args)...  args 
)
inline

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]

template<typename OuterAlloc, typename... InnerAllocs>
template<class T1 , class T2 >
void boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >::construct ( std::pair< T1, T2 > *  p)
inline
template<typename OuterAlloc, typename... InnerAllocs>
template<class T1 , class T2 >
void boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >::construct ( container_detail::pair< T1, T2 > *  p)
inline
template<typename OuterAlloc, typename... InnerAllocs>
template<class T1 , class T2 , class U , class V >
void boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >::construct ( std::pair< T1, T2 > *  p,
BOOST_FWD_REF(U)  x,
BOOST_FWD_REF(V)  y 
)
inline
template<typename OuterAlloc, typename... InnerAllocs>
template<class T1 , class T2 , class U , class V >
void boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >::construct ( container_detail::pair< T1, T2 > *  p,
BOOST_FWD_REF(U)  x,
BOOST_FWD_REF(V)  y 
)
inline
template<typename OuterAlloc, typename... InnerAllocs>
template<class T1 , class T2 , class U , class V >
void boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >::construct ( std::pair< T1, T2 > *  p,
const std::pair< U, V > &  x 
)
inline
template<typename OuterAlloc, typename... InnerAllocs>
template<class T1 , class T2 , class U , class V >
void boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >::construct ( container_detail::pair< T1, T2 > *  p,
const container_detail::pair< U, V > &  x 
)
inline
template<typename OuterAlloc, typename... InnerAllocs>
template<class T1 , class T2 , class U , class V >
void boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >::construct ( std::pair< T1, T2 > *  p,
BOOST_RV_REF_BEG std::pair< U, V > BOOST_RV_REF_END  x 
)
inline
template<typename OuterAlloc, typename... InnerAllocs>
template<class T1 , class T2 , class U , class V >
void boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >::construct ( container_detail::pair< T1, T2 > *  p,
BOOST_RV_REF_BEG container_detail::pair< U, V > BOOST_RV_REF_END  x 
)
inline
template<typename OuterAlloc, typename... InnerAllocs>
void boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >::deallocate ( pointer  p,
size_type  n 
)
inline

Effects: allocator_traits<OuterAlloc>::deallocate(outer_allocator(), p, n).

template<typename OuterAlloc, typename... InnerAllocs>
template<class T >
void boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >::destroy ( T p)
inline

Effects: calls OUTERMOST_ALLOC_TRAITS(*this)::destroy(OUTERMOST(*this), p).

inner_allocator_type& boost::container::container_detail::scoped_allocator_adaptor_base< OuterAlloc, InnerAllocs >::inner_allocator ( )
inlineinherited
inner_allocator_type const& boost::container::container_detail::scoped_allocator_adaptor_base< OuterAlloc, InnerAllocs >::inner_allocator ( ) const
inlineinherited
template<typename OuterAlloc, typename... InnerAllocs>
size_type boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >::max_size ( ) const
inline

Returns: allocator_traits<OuterAlloc>::max_size(outer_allocator()).

template<typename OuterAlloc, typename... InnerAllocs>
scoped_allocator_adaptor& boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >::operator= ( BOOST_COPY_ASSIGN_REF(scoped_allocator_adaptor< OuterAlloc, InnerAllocs >)  other)
inline
template<typename OuterAlloc, typename... InnerAllocs>
scoped_allocator_adaptor& boost::container::scoped_allocator_adaptor< OuterAlloc, InnerAllocs >::operator= ( BOOST_RV_REF(scoped_allocator_adaptor< OuterAlloc, InnerAllocs >)  other)
inline
outer_allocator_type& boost::container::container_detail::scoped_allocator_adaptor_base< OuterAlloc, InnerAllocs >::outer_allocator ( )
inlineinherited
const outer_allocator_type& boost::container::container_detail::scoped_allocator_adaptor_base< OuterAlloc, InnerAllocs >::outer_allocator ( ) const
inlineinherited
scoped_allocator_type boost::container::container_detail::scoped_allocator_adaptor_base< OuterAlloc, InnerAllocs >::select_on_container_copy_construction ( ) const
inlineinherited

The documentation for this singleton was generated from the following file: