tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
move.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2// SPDX-FileCopyrightText: Copyright (C) 2020 Tobias Hienzsch
3
4#ifndef TETL_ALGORITHM_MOVE_HPP
5#define TETL_ALGORITHM_MOVE_HPP
6
7#include <etl/_utility/move.hpp>
8
9namespace etl {
10
11/// Moves the elements in the range `[first, last)`, to another range
12/// beginning at destination, starting from first and proceeding to `last - 1`.
13/// After this operation the elements in the moved-from range will still contain
14/// valid values of the appropriate type, but not necessarily the same values as
15/// before the move.
16///
17/// https://en.cppreference.com/w/cpp/algorithm/move
18///
19/// \returns Output iterator to the element past the last element moved.
20///
21/// \param first The range of elements to move.
22/// \param last The range of elements to move.
23/// \param destination The beginning of the destination range.
24///
25/// \ingroup algorithm
26template <typename InputIt, typename OutputIt>
27constexpr auto move(InputIt first, InputIt last, OutputIt destination) -> OutputIt
28{
29 for (; first != last; ++first, (void)++destination) {
30 *destination = etl::move(*first);
31 }
32 return destination;
33}
34
35} // namespace etl
36
37#endif // TETL_ALGORITHM_MOVE_HPP
constexpr auto move(InputIt first, InputIt last, OutputIt destination) -> OutputIt
Moves the elements in the range [first, last), to another range beginning at destination,...
Definition move.hpp:27
Definition adjacent_find.hpp:9