# 25 Algorithms library [algorithms]

## 25.7 Mutating sequence operations [alg.modifying.operations]

### 25.7.6 Fill [alg.fill]

```template<class ForwardIterator, class T> constexpr void fill(ForwardIterator first, ForwardIterator last, const T& value); template<class ExecutionPolicy, class ForwardIterator, class T> void fill(ExecutionPolicy&& exec, ForwardIterator first, ForwardIterator last, const T& value); template<class OutputIterator, class Size, class T> constexpr OutputIterator fill_n(OutputIterator first, Size n, const T& value); template<class ExecutionPolicy, class ForwardIterator, class Size, class T> ForwardIterator fill_n(ExecutionPolicy&& exec, ForwardIterator first, Size n, const T& value); template<class T, output_­iterator<const T&> O, sentinel_­for<O> S> constexpr O ranges::fill(O first, S last, const T& value); template<class T, output_­range<const T&> R> constexpr borrowed_iterator_t<R> ranges::fill(R&& r, const T& value); template<class T, output_­iterator<const T&> O> constexpr O ranges::fill_n(O first, iter_difference_t<O> n, const T& value); ```
Let N be for the fill_­n algorithms, and last - first for the fill algorithms.
Mandates: The expression value is writable ([iterator.requirements.general]) to the output iterator.
The type Size is convertible to an integral type ([conv.integral], [class.conv]).
Effects: Assigns value through all the iterators in the range [first, first + N).
Returns: first + N.
Complexity: Exactly N assignments.