tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
remove_copy.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_COPY_HPP
5#define TETL_ALGORITHM_REMOVE_COPY_HPP
6
7#include <etl/_algorithm/remove_copy_if.hpp>
8
9namespace etl {
10
11/// \brief Copies elements from the range [first, last), to another range
12/// beginning at destination, omitting the elements which satisfy specific
13/// criteria. Source and destination ranges cannot overlap. Ignores all elements
14/// that are equal to value.
15/// \returns Iterator to the element past the last element copied.
16/// \ingroup algorithm
17template <typename InputIt, typename OutputIt, typename T>
18constexpr auto remove_copy(InputIt first, InputIt last, OutputIt destination, T const& value) -> OutputIt
19{
20 return etl::remove_copy_if(first, last, destination, [&value](auto const& item) { return item == value; });
21}
22
23} // namespace etl
24
25#endif // TETL_ALGORITHM_REMOVE_COPY_HPP
constexpr auto remove_copy(InputIt first, InputIt last, OutputIt destination, T const &value) -> OutputIt
Copies elements from the range [first, last), to another range beginning at destination,...
Definition remove_copy.hpp:18
Definition adjacent_find.hpp:9