tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
rotate_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_ROTATE_COPY_HPP
5#define TETL_ALGORITHM_ROTATE_COPY_HPP
6
7#include <etl/_algorithm/copy.hpp>
8
9namespace etl {
10
11/// \brief Copies the elements from the range `[first, last)`, to another range
12/// beginning at destination in such a way, that the element `nFirst` becomes
13/// the first element of the new range and `nFirst - 1` becomes the last
14/// element.
15/// \ingroup algorithm
16template <typename ForwardIt, typename OutputIt>
17constexpr auto rotate_copy(ForwardIt first, ForwardIt nFirst, ForwardIt last, OutputIt destination) -> OutputIt
18{
19 destination = etl::copy(nFirst, last, destination);
20 return etl::copy(first, nFirst, destination);
21}
22
23} // namespace etl
24
25#endif // TETL_ALGORITHM_ROTATE_COPY_HPP
constexpr auto rotate_copy(ForwardIt first, ForwardIt nFirst, ForwardIt last, OutputIt destination) -> OutputIt
Copies the elements from the range [first, last), to another range beginning at destination in such a...
Definition rotate_copy.hpp:17
Definition adjacent_find.hpp:9