std::ranges::uninitialized_value_construct
From cppreference.com
Defined in header <memory>
|
||
Call signature |
||
template< no-throw-forward-iterator I, no-throw-sentinel-for<I> S > requires std::default_initializable<std::iter_value_t<I>> |
(1) | (since C++20) (constexpr since C++26) |
template< no-throw-forward-range R > requires std::default_initializable<ranges::range_value_t<R>> |
(2) | (since C++20) (constexpr since C++26) |
1) Constructs objects of type std::iter_value_t<I> in the uninitialized memory area
[
first,
last)
by value-initialization, as if by
for (; first != last; ++first)
::new (voidify(*first))
std::remove_reference_t<std::iter_reference_t<I>>();
return first;
If an exception is thrown during the initialization, the objects already constructed are destroyed in an unspecified order.
2) Equivalent to ranges::uninitialized_value_construct(ranges::begin(r), ranges::end(r)).
The function-like entities described on this page are algorithm function objects (informally known as niebloids), that is:
- Explicit template argument lists cannot be specified when calling any of them.
- None of them are visible to argument-dependent lookup.
- When any of them are found by normal unqualified lookup as the name to the left of the function-call operator, argument-dependent lookup is inhibited.
Contents |