20 General utilities library [utilities]

20.13 Class template scoped_­allocator_­adaptor [allocator.adaptor]

20.13.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]) and x otherwise; OUTERMOST_­ALLOC_­TRAITS(x) is allocator_­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 of scoped_­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).
[[nodiscard]] pointer allocate(size_type n);
Returns: allocator_­traits<OuterAlloc>​::​allocate(outer_­allocator(), n).
[[nodiscard]] 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 A in the adaptor is initialized from the result of calling allocator_­traits<A>​::​select_­on_­container_­copy_­construction() on the corresponding allocator in *this.