20 General utilities library [utilities]

20.10 Memory [memory]

20.10.11 Specialized algorithms [specialized.algorithms]

20.10.11.8 destroy [specialized.destroy]

template<class T> void destroy_at(T* location); namespace ranges { template<Destructible T> void destroy_at(T* location) noexcept; }
Effects:
  • If T is an array type, equivalent to destroy(begin(*location), end(*location)).
  • Otherwise, equivalent to location->~T().
template<class ForwardIterator> void destroy(ForwardIterator first, ForwardIterator last);
Effects: Equivalent to:
for (; first!=last; ++first)
  destroy_at(addressof(*first));
namespace ranges { template<no-throw-input-iterator I, no-throw-sentinel<I> S> requires Destructible<iter_value_t<I>> I destroy(I first, S last) noexcept; template<no-throw-input-range R> requires Destructible<iter_value_t<iterator_t<R>>> safe_iterator_t<R> destroy(R&& r) noexcept; }
Effects: Equivalent to:
for (; first != last; ++first)
  destroy_at(addressof(*first));
return first;
template<class ForwardIterator, class Size> ForwardIterator destroy_n(ForwardIterator first, Size n);
Effects: Equivalent to:
for (; n > 0; (void)++first, --n)
  destroy_at(addressof(*first));
return first;
namespace ranges { template<no-throw-input-iterator I> requires Destructible<iter_value_t<I>> I destroy_n(I first, iter_difference_t<I> n) noexcept; }
Effects: Equivalent to:
return destroy(counted_iterator(first, n), default_sentinel).base();