6#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_UTILITY_SWAP_HPP_
7#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_UTILITY_SWAP_HPP_
13#include "arene/base/compiler_support/attributes.hpp"
14#include "arene/base/compiler_support/cpp14_inline.hpp"
15#include "arene/base/constraints/constraints.hpp"
16#include "arene/base/stdlib_choice/cstddef.hpp"
17#include "arene/base/stdlib_choice/enable_if.hpp"
18#include "arene/base/stdlib_choice/move.hpp"
19#include "arene/base/type_traits/is_swappable.hpp"
25namespace swap_detail {
34auto swap() ->
void =
delete;
48 template <
typename T, constraints<std::enable_if_t<is_default_swappable_v<T>>> =
nullptr>
49 static constexpr void default_swap(T& lhs, T& rhs)
noexcept(is_nothrow_default_swappable_v<T>) {
50 auto temp = std::move(lhs);
52 rhs = std::move(temp);
65 template <
typename T, constraints<std::enable_if_t<is_adl_swappable_v<T>>> =
nullptr>
66 constexpr void operator()(T& lhs, T& rhs)
const noexcept(
noexcept(swap(lhs, rhs))) {
79 constraints<std::enable_if_t<!is_adl_swappable_v<T>>, std::enable_if_t<is_default_swappable_v<T>>> =
nullptr>
80 constexpr void operator()(T& lhs, T& rhs)
const noexcept(
noexcept(default_swap(lhs, rhs))) {
81 default_swap(lhs, rhs);
92 template <
class T, std::size_t N, constraints<std::enable_if_t<is_swappable_v<T>>> =
nullptr>
94 constexpr void operator()(T (&lhs)[N], T (&rhs)[N])
const noexcept(is_nothrow_swappable_v<T>) {
95 for (std::size_t idx{}; idx < N; ++idx) {
96 (*
this)(lhs[idx], rhs[idx]);
103inline namespace swap_cpo {
136ARENE_MAYBE_UNUSED
static constexpr auto const& swap =
137 ::arene::base::detail::cpp14_inline_static_const<swap_detail::swap_fn_impl>::value;
Definition array_exceptions_disabled.cpp:11
Copyright 2026, Toyota Motor Corporation.
Definition array_exceptions_disabled.cpp:10