# 27 Algorithms library [algorithms]

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

### 27.7.6 Fill [alg.fill]

```template<class ForwardIterator, class T = iterator_traits<ForwardIterator>::value_type> constexpr void fill(ForwardIterator first, ForwardIterator last, const T& value); template<class ExecutionPolicy, class ForwardIterator, class T = iterator_traits<ForwardIterator>::value_type> void fill(ExecutionPolicy&& exec, ForwardIterator first, ForwardIterator last, const T& value); template<class OutputIterator, class Size, class T = iterator_traits<OutputIterator>::value_type> constexpr OutputIterator fill_n(OutputIterator first, Size n, const T& value); template<class ExecutionPolicy, class ForwardIterator, class Size, class T = iterator_traits<ForwardIterator>::value_type> ForwardIterator fill_n(ExecutionPolicy&& exec, ForwardIterator first, Size n, const T& value); template<class O, sentinel_for<O> S, class T = iter_value_t<O>> requires output_iterator<O, const T&> constexpr O ranges::fill(O first, S last, const T& value); template<class R, class T = range_value_t<R>> requires output_range<R, const T&> constexpr borrowed_iterator_t<R> ranges::fill(R&& r, const T& value); template<class O, class T = iter_value_t<O>> requires output_iterator<O, const T&> constexpr O ranges::fill_n(O first, iter_difference_t<O> n, const T& value); ```
Let N be max(0, n) 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.