tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
destroy_n.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2
3#ifndef TETL_MEMORY_DESTROY_N_HPP
4#define TETL_MEMORY_DESTROY_N_HPP
5
8
9namespace etl {
10
12template <typename ForwardIt, typename Size>
13constexpr auto destroy_n(ForwardIt first, Size n) -> ForwardIt
14{
15 for (; n > 0; (void)++first, --n) {
17 }
18 return first;
19}
20
21} // namespace etl
22
23#endif // TETL_MEMORY_DESTROY_N_HPP
Definition adjacent_find.hpp:8
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_n(ForwardIt first, Size n) -> ForwardIt
Destroys the n objects in the range starting at first.
Definition destroy_n.hpp:13
constexpr auto destroy_at(T *p) -> void
If T is not an array type, calls the destructor of the object pointed to by p, as if by p->~T()....
Definition destroy_at.hpp:16