Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
iter_swap.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_ITER_SWAP_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_ITER_SWAP_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 <utility>
12// IWYU pragma: friend "stdlib_detail/.*"
13
19
20namespace std {
21
22/// @brief swaps the objects pointed to by two iterators
23///
24/// @tparam ForwardIterator1 type of the first iterator
25/// @tparam ForwardIterator2 type of the second iterator
26/// @param lhs first iterator to object to swap
27/// @param rhs second iterator to object to swap
28template <
29 class ForwardIterator1,
30 class ForwardIterator2,
35 typename std::iterator_traits<ForwardIterator1>::reference,
36 typename std::iterator_traits<ForwardIterator2>::reference>>> = nullptr>
37constexpr auto iter_swap(
38 ForwardIterator1 lhs,
39 ForwardIterator2 rhs
40) noexcept(arene::base::
41 is_nothrow_swappable_with_v<
44 using std::swap;
45 swap(*lhs, *rhs);
46}
47
48} // namespace std
49
50#endif // INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_ITER_SWAP_HPP_
provides a uniform interface to the properties of an iterator
Definition iterator_traits.hpp:90
Public export header for the constraints subpackage.
constexpr bool is_swappable_with_v
Trait query indicating two types can be swapped.
typename constraints_impl::constraints< EnableIfs... >::type constraints
Helper used to express template constraints in a consistent way using std::enable_if_t.
Definition constraints.hpp:51
STL namespace.
constexpr auto iter_swap(ForwardIterator1 lhs, ForwardIterator2 rhs) noexcept(arene::base::is_nothrow_swappable_with_v< typename std::iterator_traits< ForwardIterator1 >::reference, typename std::iterator_traits< ForwardIterator2 >::reference >) -> void
swaps the objects pointed to by two iterators
Definition iter_swap.hpp:37
void swap(pair< T1, T2 > &lhs, pair< T1, T2 > &rhs) noexcept(arene::base::is_nothrow_swappable_v< T1 > &&arene::base::is_nothrow_swappable_v< T2 >)
Swap a pair with another instance of the same type. Swaps lhs.first with rhs.first and swaps lhs....
Definition pair.hpp:448
typename enable_if< Condition, Type >::type enable_if_t
Type alias to support constraining templates. Is an alias for the specified type if the Condition is ...
Definition enable_if.hpp:41