tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
swap_ranges.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2
3#ifndef TETL_ALGORITHM_SWAP_RANGES_HPP
4#define TETL_ALGORITHM_SWAP_RANGES_HPP
5
7
8namespace etl {
9
23template <typename ForwardIt1, typename ForwardIt2>
24constexpr auto swap_ranges(ForwardIt1 first1, ForwardIt1 last1, ForwardIt2 first2) -> ForwardIt2
25{
26 while (first1 != last1) {
27 etl::iter_swap(first1, first2);
28 ++first1;
29 ++first2;
30 }
31
32 return first2;
33}
34
35} // namespace etl
36
37#endif // TETL_ALGORITHM_SWAP_RANGES_HPP
constexpr auto iter_swap(ForwardIt1 a, ForwardIt2 b) -> void
Swaps the values of the elements the given iterators are pointing to.
Definition iter_swap.hpp:19
constexpr auto swap_ranges(ForwardIt1 first1, ForwardIt1 last1, ForwardIt2 first2) -> ForwardIt2
Exchanges elements between range [first1 ,last1) and another range starting at first2.
Definition swap_ranges.hpp:24
Definition adjacent_find.hpp:8