template< class T, class... Args >
void construct( T* p, Args&&... args );
Helper function templates
template < class T, class... Args >Constructs an object in allocated, but not initialized storage pointed to by p using the outer allocator and the provided constructor arguments. If the object is of a type that itself uses allocators, or if it is std::pair(until C++20), passes the inner allocator down to the constructed object.
1)Constructs an object of type
T
by
uses-allocator constructionat the uninitialized memory location indicated by
pusing the outermost allocator.
Given std::uses_allocator<T, inner_allocator_type>::value as uses_inner:
outermost-construct
(p, std::forward<Args>(args)...).outermost-construct
(p, std::allocator_arg,
inner_allocator(),
std::forward<Args>(args)...).outermost-construct
(p, std::forward<Args>(args)..., inner_allocator()).This overload participates in overload resolution only if T
is not a specialization of std::pair.
Equivalent to std::apply
(
[p, this](auto&&... newargs)
{
outermost-construct
(p, std::forward<decltype(newargs)>(newargs)...);
},
std::uses_allocator_construction_args
(inner_allocator(), std::forward<Args>(args)...)
); .
Given
std::uses_allocator<T, inner_allocator_type>::valueas
uses_inner:
T
x - the constructor arguments to pass to the constructor of T1
y - the constructor arguments to pass to the constructor of T2
xy - the pair whose two members are the constructor arguments for T1
and T2
tup - the arguments to be merged [edit] Notes
This function is called (through std::allocator_traits) by any allocator-aware object, such as std::vector, that was given a std::scoped_allocator_adaptor as the allocator to use. Since inner_allocator_type
is itself a specialization of std::scoped_allocator_adaptor, this function will also be called when the allocator-aware objects constructed through this function start constructing their own members.
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
DR Applied to Behavior as published Correct behavior LWG 2203 C++11 inner allocators were obtained by value-initializinginner_allocator_type
object obtained by calling inner_allocator()
LWG 2511
concat-args
might copy elements of std::tuples eliminated all element copy operations LWG 2586 C++11 only constructions from
inner_allocator_type
rvalues were checked checks constructions from non-const
inner_allocator_type
lvalues instead LWG 2975 C++11 overload (1) was not constrained constrained to refuse std::pair [edit] See also constructs an object in the allocated storage
std::allocator<T>
) [edit]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4