std::uninitialized_value_construct
From cppreference.com
| Defined in header <memory>
|
||
template< class NoThrowForwardIt >
void uninitialized_value_construct( NoThrowForwardIt first,
NoThrowForwardIt last );
|
(1) | (since C++17) (constexpr since C++26) |
template< class ExecutionPolicy, class NoThrowForwardIt >
void uninitialized_value_construct( ExecutionPolicy&& policy,
NoThrowForwardIt first,
NoThrowForwardIt last );
|
(2) | (since C++17) |
1) Constructs objects of type
typename std::iterator_traits<NoThrowForwardIt>::value_type in the uninitialized memory area [first, last) by value-initialization, as if by
for (; first != last; ++first)
::new (voidify(*first))
typename std::iterator_traits<NoThrowForwardIt>::value_type();
If an exception is thrown during the initialization, the objects already constructed are destroyed in an unspecified order.
2) Same as (1), but executed according to
policy. This overload participates in overload resolution only if all following conditions are satisfied:
|
|
(until C++20) |
|
|
(since C++20) |