Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
reverse.hpp
Go to the documentation of this file.
1
// Copyright 2026, Toyota Motor Corporation
2
//
3
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
5
#
ifndef
INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_REVERSE_HPP_
6
#
define
INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_REVERSE_HPP_
7
8
// parasoft-begin-suppress CERT_CPP-DCL58-a-2 "Part of a standard library implementation"
9
// parasoft-begin-suppress AUTOSAR-A17_6_1-a-2 "Part of a standard library implementation"
10
11
// IWYU pragma: private, include <algorithm>
12
// IWYU pragma: friend "stdlib_detail/.*"
13
14
#
include
"arene/base/constraints.hpp"
15
#
include
"arene/base/type_traits/is_swappable.hpp"
16
#
include
"arene/base/type_traits/iterator_category_traits.hpp"
17
#
include
"stdlib/include/stdlib_detail/enable_if.hpp"
18
#
include
"stdlib/include/stdlib_detail/iter_swap.hpp"
19
#
include
"stdlib/include/stdlib_detail/iterator_concepts.hpp"
20
#
include
"stdlib/include/stdlib_detail/iterator_traits.hpp"
21
22
namespace
std
{
23
24
/// @brief reverses the order of elements in a range
25
/// @tparam BidirIt The iterator used to iterate over the input range
26
/// @param first the beginning of the range
27
/// @param last the end of the range
28
template
<
29
typename
BidirIt
,
30
arene
::
base
::
constraints
<
31
std
::
enable_if_t
<
arene
::
base
::
is_bidirectional_iterator_v
<
BidirIt
>>,
32
std
::
enable_if_t
<
arene
::
base
::
is_swappable_v
<
typename
std
::
iterator_traits
<
BidirIt
>::
value_type
>>> =
nullptr
>
33
// clang-format cannot format the noexcept clause correctly
34
// clang-format off
35
constexpr
auto
reverse
(
36
BidirIt
first
,
37
BidirIt
last
38
)
noexcept
(
39
internal
::
has_nothrow_basic_bidirectional_iterator_operations_v
<
BidirIt
> &&
40
arene
::
base
::
is_nothrow_swappable_v
<
typename
std
::
iterator_traits
<
BidirIt
>::
value_type
>) ->
void
{
41
// clang-format on
42
while
(
first
!=
last
&&
first
!= --
last
) {
43
std
::
iter_swap
(
first
,
last
);
44
++
first
;
45
}
46
}
47
48
}
// namespace std
49
50
#
endif
// INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_REVERSE_HPP_
std::hash<::arene::base::result< void, E > >::operator()
constexpr auto operator()(::arene::base::result< void, E > const &value) const noexcept(noexcept(hash< E >{}(std::declval< E const & >()))) -> std::size_t
Calculate the hash of a result.
Definition
result.hpp:1827
stdlib
include
stdlib_detail
reverse.hpp
Generated by
1.13.2