Files
2025-10-25 03:02:53 +03:00

39 KiB
Raw Permalink Blame History

[specialized.algorithms]

26 Algorithms library [algorithms]

26.11 Specialized algorithms [specialized.algorithms]

26.11.1 General [specialized.algorithms.general]

1

#

The contents specified in [specialized.algorithms] are declared in the header .

2

#

Unless otherwise specified, if an exception is thrown in the following algorithms, objects constructed by a placement new-expression ([expr.new]) are destroyed in an unspecified order before allowing the exception to propagate.

3

#

[Note 1:

When new objects are created by the algorithms specified in [specialized.algorithms], the lifetime ends for any existing objects (including potentially-overlapping subobjects [intro.object]) in storage that is reused [basic.life].

— end note]

4

#

Some algorithms specified in [specialized.algorithms] make use of the following exposition-only function templates:templateconstexpr void* voidify(T& obj) noexcept {return addressof(obj); }templatedecltype(auto) deref-move(I& it) {if constexpr (is_lvalue_reference_v<decltype(*it)>)return std::move(*it); elsereturn *it; }

26.11.2 Special memory concepts [special.mem.concepts]

1

#

Some algorithms in this subclause are constrained with the following exposition-only concepts:

🔗

template<class I> concept [nothrow-input-iterator](#concept:nothrow-input-iterator "26.11.2Special memory concepts[special.mem.concepts]") = // exposition only [input_iterator](iterator.concept.input#concept:input_iterator "24.3.4.9Concept input_­iterator[iterator.concept.input]")<I> && is_lvalue_reference_v<iter_reference_t<I>> && [same_as](concept.same#concept:same_as "18.4.2Concept same_­as[concept.same]")<remove_cvref_t<iter_reference_t<I>>, iter_value_t<I>>;

2

#

A type I models nothrow-input-iterator only if no exceptions are thrown from increment, copy construction, move construction, copy assignment, move assignment, or indirection through valid iterators.

3

#

[Note 1:

This concept allows some input_iterator ([iterator.concept.input]) operations to throw exceptions.

— end note]

🔗

template<class S, class I> concept [nothrow-sentinel-for](#concept:nothrow-sentinel-for "26.11.2Special memory concepts[special.mem.concepts]") = [sentinel_for](iterator.concept.sentinel#concept:sentinel_for "24.3.4.7Concept sentinel_­for[iterator.concept.sentinel]")<S, I>; // exposition only

4

#

Types S and I model nothrow-sentinel-for only if no exceptions are thrown from copy construction, move construction, copy assignment, move assignment, or comparisons between valid values of type I and S.

5

#

[Note 2:

This concept allows some sentinel_for ([iterator.concept.sentinel]) operations to throw exceptions.

— end note]

🔗

template<class S, class I> concept [nothrow-sized-sentinel-for](#concept:nothrow-sized-sentinel-for "26.11.2Special memory concepts[special.mem.concepts]") = // exposition only [nothrow-sentinel-for](#concept:nothrow-sentinel-for "26.11.2Special memory concepts[special.mem.concepts]")<S, I> && [sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8Concept sized_­sentinel_­for[iterator.concept.sizedsentinel]")<S, I>;

6

#

Types S and I model nothrow-sized-sentinel-for only if no exceptions are thrown from the - operator for valid values of type I and S.

7

#

[Note 3:

This concept allows some sized_sentinel_for ([iterator.concept.sizedsentinel]) operations to throw exceptions.

— end note]

🔗

template<class R> concept [nothrow-input-range](#concept:nothrow-input-range "26.11.2Special memory concepts[special.mem.concepts]") = // exposition only [range](range.range#concept:range "25.4.2Ranges[range.range]")<R> && [nothrow-input-iterator](#concept:nothrow-input-iterator "26.11.2Special memory concepts[special.mem.concepts]")<iterator_t<R>> && [nothrow-sentinel-for](#concept:nothrow-sentinel-for "26.11.2Special memory concepts[special.mem.concepts]")<sentinel_t<R>, iterator_t<R>>;

8

#

A type R models nothrow-input-range only if no exceptions are thrown from calls to ranges::begin andranges::end on an object of type R.

🔗

template<class I> concept [nothrow-forward-iterator](#concept:nothrow-forward-iterator "26.11.2Special memory concepts[special.mem.concepts]") = // exposition only [nothrow-input-iterator](#concept:nothrow-input-iterator "26.11.2Special memory concepts[special.mem.concepts]")<I> && [forward_iterator](iterator.concept.forward#concept:forward_iterator "24.3.4.11Concept forward_­iterator[iterator.concept.forward]")<I> && [nothrow-sentinel-for](#concept:nothrow-sentinel-for "26.11.2Special memory concepts[special.mem.concepts]")<I, I>;

9

#

[Note 4:

This concept allows some forward_iterator ([iterator.concept.forward]) operations to throw exceptions.

— end note]

🔗

template<class R> concept [nothrow-forward-range](#concept:nothrow-forward-range "26.11.2Special memory concepts[special.mem.concepts]") = // exposition only [nothrow-input-range](#concept:nothrow-input-range "26.11.2Special memory concepts[special.mem.concepts]")<R> && [nothrow-forward-iterator](#concept:nothrow-forward-iterator "26.11.2Special memory concepts[special.mem.concepts]")<iterator_t<R>>;

🔗

template<class I> concept [nothrow-bidirectional-iterator](#concept:nothrow-bidirectional-iterator "26.11.2Special memory concepts[special.mem.concepts]") = // exposition only [nothrow-forward-iterator](#concept:nothrow-forward-iterator "26.11.2Special memory concepts[special.mem.concepts]")<I> && [bidirectional_iterator](iterator.concept.bidir#concept:bidirectional_iterator "24.3.4.12Concept bidirectional_­iterator[iterator.concept.bidir]")<I>;

10

#

A type I models nothrow-bidirectional-iterator only if no exceptions are thrown from decrementing valid iterators.

[Note 5:

This concept allows some bidirectional_iterator ([iterator.concept.bidir]) operations to throw exceptions.

— end note]

🔗

template<class R> concept [nothrow-bidirectional-range](#concept:nothrow-bidirectional-range "26.11.2Special memory concepts[special.mem.concepts]") = // exposition only [nothrow-forward-range](#concept:nothrow-forward-range "26.11.2Special memory concepts[special.mem.concepts]")<R> && [nothrow-bidirectional-iterator](#concept:nothrow-bidirectional-iterator "26.11.2Special memory concepts[special.mem.concepts]")<iterator_t<R>>;

🔗

template<class I> concept [nothrow-random-access-iterator](#concept:nothrow-random-access-iterator "26.11.2Special memory concepts[special.mem.concepts]") = // exposition only [nothrow-bidirectional-iterator](#concept:nothrow-bidirectional-iterator "26.11.2Special memory concepts[special.mem.concepts]")<I> && [random_access_iterator](iterator.concept.random.access#concept:random_access_iterator "24.3.4.13Concept random_­access_­iterator[iterator.concept.random.access]")<I> && [nothrow-sized-sentinel-for](#concept:nothrow-sized-sentinel-for "26.11.2Special memory concepts[special.mem.concepts]")<I, I>;

11

#

A type I models nothrow-random-access-iterator only if no exceptions are thrown from comparisons of valid iterators, or the -, +, -=, +=, [] operators on valid values of type I and iter_difference_t.

[Note 6:

This concept allows some random_access_iterator ([iterator.concept.random.access]) operations to throw exceptions.

— end note]

🔗

`template concept nothrow-random-access-range = // exposition only nothrow-bidirectional-range && nothrow-random-access-iterator<iterator_t>;

template concept nothrow-sized-random-access-range = // exposition only nothrow-random-access-range && sized_range; `

12

#

A type R models nothrow-sized-random-access-range only if no exceptions are thrown from the call to ranges::size on an object of type R.

26.11.3 uninitialized_default_construct [uninitialized.construct.default]

🔗

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

1

#

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

🔗

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

2

#

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

🔗

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

3

#

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

🔗

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

4

#

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

26.11.4 uninitialized_value_construct [uninitialized.construct.value]

🔗

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

1

#

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

🔗

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

2

#

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

🔗

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

3

#

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

🔗

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

4

#

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

26.11.5 uninitialized_copy [uninitialized.copy]

🔗

template<class InputIterator, class NoThrowForwardIterator> constexpr NoThrowForwardIterator uninitialized_copy(InputIterator first, InputIterator last, NoThrowForwardIterator result);

1

#

Preconditions: result+[0, (last - first)) does not overlap with [first, last).

2

#

Effects: Equivalent to:for (; first != last; ++result, (void)++first)::new (voidify(*result))typename iterator_traits::value_type(*first);

3

#

Returns: result.

🔗

namespace ranges { template<[input_iterator](iterator.concept.input#concept:input_iterator "24.3.4.9Concept input_­iterator[iterator.concept.input]") I, [sentinel_for](iterator.concept.sentinel#concept:sentinel_for "24.3.4.7Concept sentinel_­for[iterator.concept.sentinel]")<I> S1, [nothrow-forward-iterator](#concept:nothrow-forward-iterator "26.11.2Special memory concepts[special.mem.concepts]") O, [nothrow-sentinel-for](#concept:nothrow-sentinel-for "26.11.2Special memory concepts[special.mem.concepts]")<O> S2> requires [constructible_from](concept.constructible#concept:constructible_from "18.4.11Concept constructible_­from[concept.constructible]")<iter_value_t<O>, iter_reference_t<I>> constexpr uninitialized_copy_result<I, O> uninitialized_copy(I ifirst, S1 ilast, O ofirst, S2 olast); template<[input_range](range.refinements#concept:input_range "25.4.6Other range refinements[range.refinements]") IR, [nothrow-forward-range](#concept:nothrow-forward-range "26.11.2Special memory concepts[special.mem.concepts]") OR> requires [constructible_from](concept.constructible#concept:constructible_from "18.4.11Concept constructible_­from[concept.constructible]")<range_value_t<OR>, range_reference_t<IR>> constexpr uninitialized_copy_result<borrowed_iterator_t<IR>, borrowed_iterator_t<OR>> uninitialized_copy(IR&& in_range, OR&& out_range); }

4

#

Preconditions: [ofirst, olast) does not overlap with [ifirst, ilast).

5

#

Effects: Equivalent to:for (; ifirst != ilast && ofirst != olast; ++ofirst, (void)++ifirst)::new (voidify(*ofirst)) remove_reference_t<iter_reference_t>(*ifirst);return {std::move(ifirst), ofirst};

🔗

template<class InputIterator, class Size, class NoThrowForwardIterator> constexpr NoThrowForwardIterator uninitialized_copy_n(InputIterator first, Size n, NoThrowForwardIterator result);

6

#

Preconditions: result+[0, n) does not overlap with first+[0, n).

7

#

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

8

#

Returns: result.

🔗

namespace ranges { template<[input_iterator](iterator.concept.input#concept:input_iterator "24.3.4.9Concept input_­iterator[iterator.concept.input]") I, [nothrow-forward-iterator](#concept:nothrow-forward-iterator "26.11.2Special memory concepts[special.mem.concepts]") O, [nothrow-sentinel-for](#concept:nothrow-sentinel-for "26.11.2Special memory concepts[special.mem.concepts]")<O> S> requires [constructible_from](concept.constructible#concept:constructible_from "18.4.11Concept constructible_­from[concept.constructible]")<iter_value_t<O>, iter_reference_t<I>> constexpr uninitialized_copy_n_result<I, O> uninitialized_copy_n(I ifirst, iter_difference_t<I> n, O ofirst, S olast); }

9

#

Preconditions: [ofirst, olast) does not overlap withifirst+[0, n).

10

#

Effects: Equivalent to:auto t = uninitialized_copy(counted_iterator(std::move(ifirst), n), default_sentinel, ofirst, olast);return {std::move(t.in).base(), t.out};

26.11.6 uninitialized_move [uninitialized.move]

🔗

template<class InputIterator, class NoThrowForwardIterator> constexpr NoThrowForwardIterator uninitialized_move(InputIterator first, InputIterator last, NoThrowForwardIterator result);

1

#

Preconditions: result+[0, (last - first)) does not overlap with [first, last).

2

#

Effects: Equivalent to:for (; first != last; (void)++result, ++first)::new (voidify(*result))typename iterator_traits::value_type(deref-move(first));return result;

🔗

namespace ranges { template<[input_iterator](iterator.concept.input#concept:input_iterator "24.3.4.9Concept input_­iterator[iterator.concept.input]") I, [sentinel_for](iterator.concept.sentinel#concept:sentinel_for "24.3.4.7Concept sentinel_­for[iterator.concept.sentinel]")<I> S1, [nothrow-forward-iterator](#concept:nothrow-forward-iterator "26.11.2Special memory concepts[special.mem.concepts]") O, [nothrow-sentinel-for](#concept:nothrow-sentinel-for "26.11.2Special memory concepts[special.mem.concepts]")<O> S2> requires [constructible_from](concept.constructible#concept:constructible_from "18.4.11Concept constructible_­from[concept.constructible]")<iter_value_t<O>, iter_rvalue_reference_t<I>> constexpr uninitialized_move_result<I, O> uninitialized_move(I ifirst, S1 ilast, O ofirst, S2 olast); template<[input_range](range.refinements#concept:input_range "25.4.6Other range refinements[range.refinements]") IR, [nothrow-forward-range](#concept:nothrow-forward-range "26.11.2Special memory concepts[special.mem.concepts]") OR> requires [constructible_from](concept.constructible#concept:constructible_from "18.4.11Concept constructible_­from[concept.constructible]")<range_value_t<OR>, range_rvalue_reference_t<IR>> constexpr uninitialized_move_result<borrowed_iterator_t<IR>, borrowed_iterator_t<OR>> uninitialized_move(IR&& in_range, OR&& out_range); }

3

#

Preconditions: [ofirst, olast) does not overlap with [ifirst, ilast).

4

#

Effects: Equivalent to:for (; ifirst != ilast && ofirst != olast; ++ofirst, (void)++ifirst)::new (voidify(*ofirst)) remove_reference_t<iter_reference_t>(ranges::iter_move(ifirst));return {std::move(ifirst), ofirst};

5

#

[Note 1:

If an exception is thrown, some objects in the range [ifirst, ilast) are left in a valid, but unspecified state.

— end note]

🔗

template<class InputIterator, class Size, class NoThrowForwardIterator> constexpr pair<InputIterator, NoThrowForwardIterator> uninitialized_move_n(InputIterator first, Size n, NoThrowForwardIterator result);

6

#

Preconditions: result+[0, n) does not overlap with first+[0, n).

7

#

Effects: Equivalent to:for (; n > 0; ++result, (void)++first, --n)::new (voidify(*result))typename iterator_traits::value_type(deref-move(first));return {first, result};

🔗

namespace ranges { template<[input_iterator](iterator.concept.input#concept:input_iterator "24.3.4.9Concept input_­iterator[iterator.concept.input]") I, [nothrow-forward-iterator](#concept:nothrow-forward-iterator "26.11.2Special memory concepts[special.mem.concepts]") O, [nothrow-sentinel-for](#concept:nothrow-sentinel-for "26.11.2Special memory concepts[special.mem.concepts]")<O> S> requires [constructible_from](concept.constructible#concept:constructible_from "18.4.11Concept constructible_­from[concept.constructible]")<iter_value_t<O>, iter_rvalue_reference_t<I>> constexpr uninitialized_move_n_result<I, O> uninitialized_move_n(I ifirst, iter_difference_t<I> n, O ofirst, S olast); }

8

#

Preconditions: [ofirst, olast) does not overlap with ifirst+[0, n).

9

#

Effects: Equivalent to:auto t = uninitialized_move(counted_iterator(std::move(ifirst), n), default_sentinel, ofirst, olast);return {std::move(t.in).base(), t.out};

10

#

[Note 2:

If an exception is thrown, some objects in the rangeifirst+[0, n) are left in a valid but unspecified state.

— end note]

26.11.7 uninitialized_fill [uninitialized.fill]

🔗

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

1

#

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

🔗

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

2

#

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

🔗

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

3

#

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

🔗

namespace ranges { template<[nothrow-forward-iterator](#concept:nothrow-forward-iterator "26.11.2Special memory concepts[special.mem.concepts]") I, class T> requires [constructible_from](concept.constructible#concept:constructible_from "18.4.11Concept 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

#

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

26.11.8 construct_at [specialized.construct]

🔗

`template<class T, class... Args> constexpr T* construct_at(T* location, Args&&... args);

namespace ranges { template<class T, class... Args> constexpr T* construct_at(T* location, Args&&... args); } `

1

#

Constraints: is_unbounded_array_v is false.

The expression ::new (declval<void*>()) T(declval()...) is well-formed when treated as an unevaluated operand ([expr.context]).

2

#

Mandates: If is_array_v is true, sizeof...(Args) is zero.

3

#

Effects: Equivalent to:if constexpr (is_array_v)return ::new (voidify(*location)) T1;elsereturn ::new (voidify(*location)) T(std::forward(args)...);

26.11.9 destroy [specialized.destroy]

🔗

template<class T> constexpr void destroy_at(T* location); namespace ranges { template<[destructible](concept.destructible#concept:destructible "18.4.10Concept destructible[concept.destructible]") T> constexpr void destroy_at(T* location) noexcept; }

1

#

Effects:

  • (1.1)

    If T is an array type, equivalent to destroy(begin(*location), end(*location)).

  • (1.2)

    Otherwise, equivalent to location->~T().

🔗

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

2

#

Effects: Equivalent to:for (; first != last; ++first) destroy_at(addressof(*first));

🔗

namespace ranges { template<[nothrow-input-iterator](#concept:nothrow-input-iterator "26.11.2Special memory concepts[special.mem.concepts]") I, [nothrow-sentinel-for](#concept:nothrow-sentinel-for "26.11.2Special memory concepts[special.mem.concepts]")<I> S> requires [destructible](concept.destructible#concept:destructible "18.4.10Concept destructible[concept.destructible]")<iter_value_t<I>> constexpr I destroy(I first, S last) noexcept; template<[nothrow-input-range](#concept:nothrow-input-range "26.11.2Special memory concepts[special.mem.concepts]") R> requires [destructible](concept.destructible#concept:destructible "18.4.10Concept destructible[concept.destructible]")<range_value_t<R>> constexpr borrowed_iterator_t<R> destroy(R&& r) noexcept; }

3

#

Effects: Equivalent to:for (; first != last; ++first) destroy_at(addressof(*first));return first;

🔗

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

4

#

Effects: Equivalent to:for (; n > 0; (void)++first, --n) destroy_at(addressof(*first));return first;

🔗

namespace ranges { template<[nothrow-input-iterator](#concept:nothrow-input-iterator "26.11.2Special memory concepts[special.mem.concepts]") I> requires [destructible](concept.destructible#concept:destructible "18.4.10Concept destructible[concept.destructible]")<iter_value_t<I>> constexpr I destroy_n(I first, iter_difference_t<I> n) noexcept; }

5

#

Effects: Equivalent to:return destroy(counted_iterator(std::move(first), n), default_sentinel).base();