tetl
0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
copy.hpp
Go to the documentation of this file.
1
// SPDX-License-Identifier: BSL-1.0
2
// SPDX-FileCopyrightText: Copyright (C) 2019 Tobias Hienzsch
3
4
#
ifndef
TETL_ALGORITHM_COPY_HPP
5
#
define
TETL_ALGORITHM_COPY_HPP
6
7
namespace
etl
{
8
9
/// \brief Copies the elements in the range, defined by `[first, last)`, to
10
/// another range beginning at destination.
11
/// \details Copies all elements in the range `[first, last)` starting from
12
/// first and proceeding to `last - 1`. The behavior is undefined if destination
13
/// is within the range `[first, last)`. In this case, copy_backward may be used
14
/// instead.
15
/// \returns Output iterator to the element in the destination range, one past
16
/// the last element copied.
17
/// \ingroup algorithm
18
template
<
typename
InputIt,
typename
OutputIt>
19
constexpr
auto
copy
(InputIt first, InputIt last, OutputIt destination) -> OutputIt
20
{
21
for
(; first != last; ++first, (
void
)++destination) {
22
*destination = *first;
23
}
24
return
destination;
25
}
26
27
}
// namespace etl
28
29
#
endif
// TETL_ALGORITHM_COPY_HPP
etl::copy
constexpr auto copy(InputIt first, InputIt last, OutputIt destination) -> OutputIt
Copies the elements in the range, defined by [first, last), to another range beginning at destination...
Definition
copy.hpp:19
etl
Definition
adjacent_find.hpp:9
include
etl
_algorithm
copy.hpp
Generated on Sun Sep 7 2025 19:14:46 for tetl by
1.9.8