[uninitialized.construct.value]

# 26 Algorithms library [[algorithms]](./#algorithms)

## 26.11 Specialized <memory> algorithms [[specialized.algorithms]](specialized.algorithms#uninitialized.construct.value)

### 26.11.4 uninitialized_value_construct [uninitialized.construct.value]

[ð](#lib:uninitialized_value_construct)

`template<class NoThrowForwardIterator>
  constexpr void uninitialized_value_construct(NoThrowForwardIterator first,
                                               NoThrowForwardIterator last);
`

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L13799)

*Effects*: Equivalent to:for (; first != last; ++first)::new (*voidify*(*first))typename iterator_traits<NoThrowForwardIterator>::value_type();

[ð](#lib:uninitialized_value_construct_)

`namespace ranges {
  template<[nothrow-forward-iterator](special.mem.concepts#concept:nothrow-forward-iterator "26.11.2 Special memory concepts [special.mem.concepts]") I, [nothrow-sentinel-for](special.mem.concepts#concept:nothrow-sentinel-for "26.11.2 Special memory concepts [special.mem.concepts]")<I> S>
    requires [default_initializable](concept.default.init#concept:default_initializable "18.4.12 Concept default_­initializable [concept.default.init]")<iter_value_t<I>>
    constexpr I uninitialized_value_construct(I first, S last);
  template<[nothrow-forward-range](special.mem.concepts#concept:nothrow-forward-range "26.11.2 Special memory concepts [special.mem.concepts]") R>
    requires [default_initializable](concept.default.init#concept:default_initializable "18.4.12 Concept default_­initializable [concept.default.init]")<range_value_t<R>>
    constexpr borrowed_iterator_t<R> uninitialized_value_construct(R&& r);
}
`

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L13822)

*Effects*: Equivalent to:for (; first != last; ++first)::new (*voidify*(*first)) remove_reference_t<iter_reference_t<I>>();return first;

[ð](#lib:uninitialized_value_construct_n)

`template<class NoThrowForwardIterator, class Size>
  constexpr NoThrowForwardIterator
    uninitialized_value_construct_n(NoThrowForwardIterator first, Size n);
`

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L13840)

*Effects*: Equivalent to:for (; n > 0; (void)++first, --n)::new (*voidify*(*first))typename iterator_traits<NoThrowForwardIterator>::value_type();return first;

[ð](#lib:uninitialized_value_construct_n_)

`namespace ranges {
  template<[nothrow-forward-iterator](special.mem.concepts#concept:nothrow-forward-iterator "26.11.2 Special memory concepts [special.mem.concepts]") I>
    requires [default_initializable](concept.default.init#concept:default_initializable "18.4.12 Concept default_­initializable [concept.default.init]")<iter_value_t<I>>
    constexpr I uninitialized_value_construct_n(I first, iter_difference_t<I> n);
}
`

[4](#4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L13861)

*Effects*: Equivalent to:return uninitialized_value_construct(counted_iterator(first, n),
 default_sentinel).base();
