Iros
 
Loading...
Searching...
No Matches
swap_ranges.h
Go to the documentation of this file.
1#pragma once
2
7
8namespace di::container {
9namespace detail {
10 struct SwapRanges {
11 template<concepts::InputIterator It1, concepts::SentinelFor<It1> Sent1, concepts::InputIterator It2,
12 concepts::SentinelFor<It2> Sent2>
14 constexpr auto operator()(It1 first1, Sent1 last1, It2 first2, Sent2 last2) const -> InInResult<It1, It2> {
15 for (; first1 != last1 && first2 != last2; ++first1, ++first2) {
16 container::iterator_swap(first1, first2);
17 }
18 return { util::move(first1), util::move(first2) };
19 }
20
21 template<concepts::InputContainer Con1, concepts::InputContainer Con2>
23 constexpr auto operator()(Con1&& container1, Con2&& container2) const
25 return (*this)(container::begin(container1), container::end(container1), container::begin(container2),
26 container::end(container2));
27 }
28 };
29}
30
31constexpr inline auto swap_ranges = detail::SwapRanges {};
32}
33
34namespace di {
36}
Definition indirectly_swappable.h:7
Definition sequence.h:13
Definition sequence.h:12
constexpr auto swap_ranges
Definition swap_ranges.h:31
constexpr auto iterator_swap
Definition iterator_swap.h:49
constexpr auto end
Definition end.h:47
constexpr auto begin
Definition begin.h:44
Conditional< concepts::BorrowedContainer< Con >, ContainerIterator< Con >, container::Dangling > BorrowedIterator
Definition borrowed_iterator.h:11
decltype(container::begin(util::declval< T & >())) ContainerIterator
Definition container_iterator.h:8
Definition zstring_parser.h:9
Definition in_in_result.h:8
Definition swap_ranges.h:10