[allocator.adaptor.members] (original) (raw)
20 Memory management library [mem]
20.6 Class template scoped_allocator_adaptor [allocator.adaptor]
20.6.4 Members [allocator.adaptor.members]
In the construct member functions,OUTERMOST(x) is_OUTERMOST_(x.outer_allocator()) if the expression x.outer_allocator() is valid ([temp.deduct]) andx otherwise;OUTERMOST_ALLOC_TRAITS(x) isallocator_traits<remove_reference_t<decltype(_OUTERMOST_(x))>>.
[Note 1:
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 ofscoped_allocator_adaptor.
— _end note_]
inner_allocator_type& inner_allocator() noexcept;const inner_allocator_type& inner_allocator() const noexcept;
Returns: *this if sizeof...(InnerAllocs) is zero; otherwise,inner.
outer_allocator_type& outer_allocator() noexcept;
Returns: static_cast<OuterAlloc&>(*this).
const outer_allocator_type& outer_allocator() const noexcept;
Returns: static_cast<const OuterAlloc&>(*this).
pointer allocate(size_type n);
Returns: allocator_traits<OuterAlloc>::allocate(outer_allocator(), n).
pointer allocate(size_type n, const_void_pointer hint);
Returns: allocator_traits<OuterAlloc>::allocate(outer_allocator(), n, hint).
void deallocate(pointer p, size_type n) noexcept;
Effects: As if by:allocator_traits<OuterAlloc>::deallocate(outer_allocator(), p, n);
size_type max_size() const;
Returns: allocator_traits<OuterAlloc>::max_size(outer_allocator()).
template<class T, class... Args> void construct(T* p, Args&&... args);
Effects: Equivalent to:apply([p, this](auto&&... newargs) { OUTERMOST_ALLOC_TRAITS(*this)::construct( OUTERMOST(*this), p, std::forward<decltype(newargs)>(newargs)...);}, uses_allocator_construction_args<T>(inner_allocator(), std::forward<Args>(args)...));
template<class T> void destroy(T* p);
Effects: Calls OUTERMOST_ALLOC_TRAITS(*this)::destroy(OUTERMOST(*this), p).
scoped_allocator_adaptor select_on_container_copy_construction() const;
Returns: A new scoped_allocator_adaptor object where each allocator a1 within the adaptor is initialized withallocator_traits<A1>::select_on_container_copy_construction(a2), where A1 is the type of a1 anda2 is the corresponding allocator in *this.