std::scoped_allocator_adaptor<OuterAlloc,InnerAlloc...>::construct (3) - Linux Manuals
std::scoped_allocator_adaptor<OuterAlloc,InnerAlloc...>::construct: std::scoped_allocator_adaptor<OuterAlloc,InnerAlloc...>::construct
NAME
std::scoped_allocator_adaptor<OuterAlloc,InnerAlloc...>::construct - std::scoped_allocator_adaptor<OuterAlloc,InnerAlloc...>::construct
Synopsis
Defined in header <scoped_allocator>
template < class T, class... Args > (1)
void construct( T* p, Args&&... args );
template< class T1, class T2, class... Args1, class... Args2 >
void construct( std::pair<T1, T2>* p,
std::piecewise_construct_t, (2) (until C++20)
std::tuple<Args1...> x,
std::tuple<Args2...> y );
template< class T1, class T2 > (3) (until C++20)
void construct( std::pair<T1, T2>* p );
template< class T1, class T2, class U, class V > (4) (until C++20)
void construct( std::pair<T1, T2>* p, U&& x, V&& y );
template< class T1, class T2, class U, class V > (5) (until C++20)
void construct( std::pair<T1, T2>* p, const std::pair<U, V>& xy );
template< class T1, class T2, class U, class V > (6) (until C++20)
void construct( std::pair<T1, T2>* p, std::pair<U, V>&& xy );
Constructs an object in allocated, but not initialized storage pointed to by p using OuterAllocator and the provided constructor arguments. If the object is of type that itself uses allocators, or if it is std::pair, passes InnerAllocator down to the constructed object.
First, retrieve the outermost allocator OUTERMOST by calling this->outer_allocator(), and then calling the outer_allocator() member function recursively on the result of this call until reaching an allocator that has no such member function.
Define OUTERMOST_ALLOC_TRAITS(x) as std::allocator_traits<std::remove_reference_t<decltype(OUTERMOST(x))>>
1) Creates an object of the given type T by means of uses-allocator_construction at the uninitialized memory location indicated by p, using OUTERMOST as the allocator. After adjustment for uses-allocator convention expected by T's constructor, calls OUTERMOST_ALLOC_TRAITS(*this)::construct.
This overload only participates in overload resolution if U is not a specialization of std::pair. (until C++20)
Equivalent to
2) First, if either T1 or T2 is allocator-aware, modifies the tuples x and y to include the appropriate inner allocator, resulting in the two new tuples xprime and yprime, according to the following three rules:
2a) if T1 is not allocator-aware (std::uses_allocator<T1, inner_allocator_type>::value==false, then xprime is std::tuple<Args1&&...>(std::move(x)). (it is also required that std::is_constructible<T1, Args1...>::value==true)
2b) if T1 is allocator-aware (std::uses_allocator<T1, inner_allocator_type>::value==true), and its constructor takes an allocator tag (std::is_constructible<T1, std::allocator_arg_t, inner_allocator_type&, Args1...>::value==true), then xprime is
2c) if T1 is allocator-aware (std::uses_allocator<T1, inner_allocator_type>::value==true), and its constructor takes the allocator as the last argument (std::is_constructible<T1, Args1..., inner_allocator_type&>::value==true), then xprime is std::tuple_cat(std::tuple<Args1&&...>(std::move(x)), std::tuple<inner_allocator_type&>(inner_allocator())).
Same rules apply to T2 and the replacement of y with yprime
Once xprime and yprime are constructed, constructs the pair p in allocated storage by calling