CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
is_swappable.hpp
Go to the documentation of this file.
1//
2// CeresEngine - A game development framework
3//
4// Created by Rogiel Sulzbach.
5// Copyright (c) 2018-2022 Rogiel Sulzbach. All rights reserved.
6//
7
8#pragma once
9
10#include <type_traits>
11
12namespace CeresEngine::traits {
13
15 template<class T, class = void> struct is_swappable : std::false_type {};
16
17 template<class T>
18 struct is_swappable<T,
19 std::void_t<
20 // clang-format off
21 decltype(std::swap(std::declval<T&>(), std::declval<T&>()))
22 // clang-format on
23 >> : std::true_type {};
24
26 template<class T> bool constexpr is_swappable_v = is_swappable<T>::value;
27
29 template<class T>
31
32} // namespace CeresEngine::traits
Definition is_swappable.hpp:30
Definition Partitioner.hpp:146
bool constexpr is_swappable_v
A C++17 type trait equivalent to the C++20 swappable concept.
Definition is_swappable.hpp:26
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
Definition Span.hpp:668
A C++17 type trait equivalent to the C++20 swappable concept.
Definition is_swappable.hpp:15