tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
remove.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2// SPDX-FileCopyrightText: Copyright (C) 2019 Tobias Hienzsch
3
4#ifndef TETL_ALGORITHM_REMOVE_HPP
5#define TETL_ALGORITHM_REMOVE_HPP
6
7#include <etl/_algorithm/remove_if.hpp>
8
9namespace etl {
10
11/// \brief Removes all elements satisfying specific criteria from the range
12/// `[first, last)` and returns a past-the-end iterator for the new end of the
13/// range.
14/// \ingroup algorithm
15template <typename ForwardIt, typename T>
16[[nodiscard]] constexpr auto remove(ForwardIt first, ForwardIt last, T const& value) -> ForwardIt
17{
18 return etl::remove_if(first, last, [&value](auto const& item) { return item == value; });
19}
20
21} // namespace etl
22
23#endif // TETL_ALGORITHM_REMOVE_HPP
constexpr auto remove(ForwardIt first, ForwardIt last, T const &value) -> ForwardIt
Removes all elements satisfying specific criteria from the range [first, last) and returns a past-the...
Definition remove.hpp:16
Definition adjacent_find.hpp:9