4.5 KiB
[allocator.adaptor.members]
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) isOUTERMOST(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) andOUTERMOST_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::allocate(outer_allocator(), n).
pointer allocate(size_type n, const_void_pointer hint);
Returns: allocator_traits::allocate(outer_allocator(), n, hint).
void deallocate(pointer p, size_type n) noexcept;
Effects: As if by:allocator_traits::deallocate(outer_allocator(), p, n);
size_type max_size() const;
Returns: allocator_traits::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(inner_allocator(), std::forward(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::select_on_container_copy_construction(a2), where A1 is the type of a1 anda2 is the corresponding allocator in *this.