[uninitialized.fill] # 26 Algorithms library [[algorithms]](./#algorithms) ## 26.11 Specialized algorithms [[specialized.algorithms]](specialized.algorithms#uninitialized.fill) ### 26.11.7 uninitialized_fill [uninitialized.fill] [🔗](#lib:uninitialized_fill) `template 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::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]") S, class T> requires [constructible_from](concept.constructible#concept:constructible_from "18.4.11 Concept constructible_­from [concept.constructible]"), 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]"), const T&> constexpr borrowed_iterator_t 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>(x);return first; [🔗](#lib:uninitialized_fill_n) `template 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::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]"), const T&> constexpr I uninitialized_fill_n(I first, iter_difference_t 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();