Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
copy.hpp
Go to the documentation of this file.
1// Copyright 2024, Toyota Motor Corporation
2//
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
5#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_ALGORITHM_COPY_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_ALGORITHM_COPY_HPP_
7
8// IWYU pragma: private, include "arene/base/algorithm.hpp"
9// IWYU pragma: friend "(arene/base(?!/tests)|stdlib/include/stdlib_detail)/.*"
10
11// parasoft-begin-suppress AUTOSAR-A16_2_2-a-2 "Arene Base aggregate headers permitted by A16-2-2 Permit #1"
12#include "arene/base/constraints/constraints.hpp"
13#include "arene/base/stdlib_choice/declval.hpp"
14#include "arene/base/stdlib_choice/enable_if.hpp"
15#include "arene/base/stdlib_choice/is_assignable.hpp"
16#include "arene/base/stdlib_choice/iterator_traits.hpp"
17#include "arene/base/type_traits/iterator_category_traits.hpp"
18// parasoft-end-suppress AUTOSAR-A16_2_2-a-2
19
20namespace arene {
21namespace base {
22
23// parasoft-begin-suppress AUTOSAR-M3_3_2-a "False positive: this function does not have internal linkage"
24// parasoft-begin-suppress AUTOSAR-M5_0_15-a "False positive: this is generic iterator arithmetic, not pointer-specific"
25
26/// @brief Copies the elements in the range, defined by <tt>[first, last)</tt>,
27/// to another range beginning at @c output.
28/// @tparam InputIterator The type of the Source iterator
29/// @tparam OutputIterator The type of the Destination iterator
30/// @param first Start of the range of elements to copy from
31/// @param last End (non-inclusive) of the range of elements to copy from
32/// @param output Start of the range of elements to copy into
33/// @return OutputIterator An iterator after the last copied item
34template <
35 class InputIterator,
36 class OutputIterator,
41 noexcept(*(++output)) && noexcept(*(++first)) && noexcept(first != last) &&
43 decltype(*std::declval<OutputIterator&>()),
45) -> OutputIterator {
46 while (first != last) {
47 *output = *first;
48 ++first;
49 ++output;
50 }
51
52 return output;
53}
54
55// parasoft-end-suppress AUTOSAR-M3_3_2-a
56// parasoft-end-suppress AUTOSAR-M5_0_15-a
57
58} // namespace base
59} // namespace arene
60
61#endif // INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_ALGORITHM_COPY_HPP_
Definition array_exceptions_disabled.cpp:11
Copyright 2026, Toyota Motor Corporation.
Definition array_exceptions_disabled.cpp:10