Iros
Loading...
Searching...
No Matches
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
CopyFunction
{
11
template
<concepts::InputIterator 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
// FIXME: use vectorized byte copy (::memcpy_forward) when provided contiguous
15
// iterators to trivially copyable types.
16
for
(; first != last; ++first, ++output) {
17
*output = *first;
18
}
19
return
{ util::move(first), util::move(output) };
20
}
21
22
template
<concepts::InputContainer Con, concepts::WeaklyIncrementable Out>
23
requires
(
concepts::IndirectlyCopyable<meta::ContainerIterator<Con>
, Out>)
24
constexpr
auto
operator
()(Con&&
container
, Out output)
const
->
InOutResult
<
meta::BorrowedIterator<Con>
, Out> {
25
return
(*
this
)(
container::begin
(
container
),
container::end
(
container
), util::move(output));
26
}
27
};
28
}
29
30
constexpr
inline
auto
copy
=
detail::CopyFunction
{};
31
}
32
33
namespace
di
{
34
using
container::copy
;
35
}
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::end
constexpr auto end
Definition
end.h:47
di::container::copy
constexpr auto copy
Definition
copy.h:30
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::CopyFunction
Definition
copy.h:10
libs
di
include
di
container
algorithm
copy.h
Generated by
1.13.0