tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
ranges_destroy.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2
3#ifndef TETL_MEMORY_RANGES_DESTROY_HPP
4#define TETL_MEMORY_RANGES_DESTROY_HPP
5
10#include <etl/_ranges/begin.hpp>
11#include <etl/_ranges/end.hpp>
14
15namespace etl::ranges {
16
17inline constexpr struct destroy_fn {
18 template <typename /*no-throw-input-iterator*/ I, typename /*no-throw-sentinel-for<I>*/ S>
20 constexpr auto operator()(I first, S last) const noexcept -> I
21 {
22 for (; first != last; ++first) {
24 }
25 return first;
26 }
27
28 template <typename /*no-throw-input-range*/ R>
30 constexpr auto operator()(R&& r) const noexcept -> auto /*etl::ranges::borrowed_iterator_t<R>*/
31 {
32 return (*this)(etl::ranges::begin(r), etl::ranges::end(r));
33 }
35
36} // namespace etl::ranges
37
38#endif // TETL_MEMORY_RANGES_DESTROY_HPP
The concept destructible specifies the concept of all types whose instances can safely be destroyed a...
Definition destructible.hpp:15
constexpr auto end
Definition end.hpp:56
constexpr auto begin
Definition begin.hpp:61
Definition ranges_in_fun_result.hpp:11
constexpr struct etl::ranges::destroy_at_fn destroy_at
constexpr auto addressof(T &arg) noexcept -> T *
Obtains the actual address of the object or function arg, even in presence of overloaded operator&.
Definition addressof.hpp:15
constexpr auto destroy(ForwardIt first, ForwardIt last) -> void
Destroys the objects in the range [first, last).
Definition destroy.hpp:13
Definition ranges_destroy.hpp:17
constexpr auto operator()(R &&r) const noexcept -> auto
Definition ranges_destroy.hpp:30
constexpr auto operator()(I first, S last) const noexcept -> I
Definition ranges_destroy.hpp:20