Namespaces
Variants

std::uninitialized_value_construct

From cppreference.com
 
 
Memory management library
(exposition only*)
Allocators
Uninitialized memory algorithms
Constrained uninitialized memory algorithms
Memory resources
Uninitialized storage (until C++20)
(until C++20*)
(until C++20*)

Garbage collector support (until C++23)
(C++11)(until C++23)
(C++11)(until C++23)
(C++11)(until C++23)
(C++11)(until C++23)
(C++11)(until C++23)
(C++11)(until C++23)
Low level memory
management
    
(C++17)
Smart pointers
(C++11)
(C++11)
(C++11)
(until C++17*)
(C++11)
(C++26)
(C++23)
Miscellaneous
(C++20)
(C++11)
(C++11)
C Library
(C++26)
 
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 [firstlast) 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:

std::is_execution_policy_v<std::decay_t<ExecutionPolicy>> is true.

(until C++20)

std::is_execution_policy_v<std::remove_cvref_t<ExecutionPolicy>> is true.

(since C++20)