Iros
 
Loading...
Searching...
No Matches
copy.h
Go to the documentation of this file.
1#pragma once
2
7
8namespace di::container {
9namespace detail {
10 struct CopyFunction {
11 template<concepts::InputIterator It, concepts::SentinelFor<It> Sent, concepts::WeaklyIncrementable 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>
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
30constexpr inline auto copy = detail::CopyFunction {};
31}
32
33namespace di {
34using container::copy;
35}
Definition indirectly_copyable.h:9
Definition sequence.h:13
Definition sequence.h:12
constexpr auto end
Definition end.h:47
constexpr auto copy
Definition copy.h:30
constexpr auto begin
Definition begin.h:44
Conditional< concepts::BorrowedContainer< Con >, ContainerIterator< Con >, container::Dangling > BorrowedIterator
Definition borrowed_iterator.h:11
Definition zstring_parser.h:9
Definition in_out_result.h:8