Iros
Loading...
Searching...
No Matches
reverse_copy.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
di/container/algorithm/in_out_result.h
"
4
#include "
di/container/concepts/prelude.h
"
5
#include "
di/container/iterator/prelude.h
"
6
#include "
di/container/meta/prelude.h
"
7
8
namespace
di::container
{
9
namespace
detail
{
10
struct
ReverseCopyFunction
{
11
template
<concepts::B
id
irectionalIterator It, concepts::SentinelFor<It> Sent, concepts::WeaklyIncrementable Out>
12
requires
(
concepts::IndirectlyCopyable<It, Out>
)
13
constexpr
auto
operator
()(It first, Sent last, Out output)
const
->
InOutResult<It, Out>
{
14
auto
last_it =
container::next
(first, last);
15
for
(
auto
it = last_it; it != first; ++output) {
16
*output = *--it;
17
}
18
return
{ util::move(last_it), util::move(output) };
19
}
20
21
template
<concepts::B
id
irectionalContainer Con, concepts::WeaklyIncrementable Out>
22
requires
(
concepts::IndirectlyCopyable<meta::ContainerIterator<Con>
, Out>)
23
constexpr
auto
operator
()(Con&&
container
, Out output)
const
->
InOutResult
<
meta::BorrowedIterator<Con>
, Out> {
24
return
(*
this
)(
container::begin
(
container
),
container::end
(
container
), util::move(output));
25
}
26
};
27
}
28
29
constexpr
inline
auto
reverse_copy
=
detail::ReverseCopyFunction
{};
30
}
31
32
namespace
di
{
33
using
container::reverse_copy
;
34
}
di::concepts::IndirectlyCopyable
Definition
indirectly_copyable.h:9
in_out_result.h
prelude.h
prelude.h
prelude.h
di::container::detail
Definition
sequence.h:13
di::container
Definition
sequence.h:12
di::container::next
constexpr auto next
Definition
next.h:35
di::container::end
constexpr auto end
Definition
end.h:47
di::container::reverse_copy
constexpr auto reverse_copy
Definition
reverse_copy.h:29
di::container::begin
constexpr auto begin
Definition
begin.h:44
di::meta::BorrowedIterator
Conditional< concepts::BorrowedContainer< Con >, ContainerIterator< Con >, container::Dangling > BorrowedIterator
Definition
borrowed_iterator.h:11
di
Definition
zstring_parser.h:9
di::container::InOutResult
Definition
in_out_result.h:8
di::container::detail::ReverseCopyFunction
Definition
reverse_copy.h:10
libs
di
include
di
container
algorithm
reverse_copy.h
Generated by
1.13.0