[uninitialized.fill]

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

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

### 26.11.7 uninitialized_fill [uninitialized.fill]

[ð](#lib:uninitialized_fill)

`template<class NoThrowForwardIterator, class T>
  constexpr void uninitialized_fill(NoThrowForwardIterator first,
                                    NoThrowForwardIterator last, const T& x);
`

[1](#1)

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

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

[ð](#lib:uninitialized_fill_)

`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, class T>
    requires [constructible_from](concept.constructible#concept:constructible_from "18.4.11 Concept constructible_­from [concept.constructible]")<iter_value_t<I>, const T&>
    constexpr I uninitialized_fill(I first, S last, const T& x);
  template<[nothrow-forward-range](special.mem.concepts#concept:nothrow-forward-range "26.11.2 Special memory concepts [special.mem.concepts]") R, class T>
    requires [constructible_from](concept.constructible#concept:constructible_from "18.4.11 Concept constructible_­from [concept.constructible]")<range_value_t<R>, const T&>
    constexpr borrowed_iterator_t<R> uninitialized_fill(R&& r, const T& x);
}
`

[2](#2)

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

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

[ð](#lib:uninitialized_fill_n)

`template<class NoThrowForwardIterator, class Size, class T>
  constexpr NoThrowForwardIterator
    uninitialized_fill_n(NoThrowForwardIterator first, Size n, const T& x);
`

[3](#3)

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

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

[ð](#lib:uninitialized_fill_n_)

`namespace ranges {
  template<[nothrow-forward-iterator](special.mem.concepts#concept:nothrow-forward-iterator "26.11.2 Special memory concepts [special.mem.concepts]") I, class T>
    requires [constructible_from](concept.constructible#concept:constructible_from "18.4.11 Concept constructible_­from [concept.constructible]")<iter_value_t<I>, const T&>
    constexpr I uninitialized_fill_n(I first, iter_difference_t<I> n, const T& x);
}
`

[4](#4)

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

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