Phi
is_swappable.hpp
1 #ifndef INCG_PHI_CORE_TYPE_TRAITS_IS_SWAPPABLE_HPP
2 #define INCG_PHI_CORE_TYPE_TRAITS_IS_SWAPPABLE_HPP
3 
4 #include "phi/phi_config.hpp"
5 
6 #if PHI_HAS_EXTENSION_PRAGMA_ONCE()
7 # pragma once
8 #endif
9 
10 #include "phi/compiler_support/constexpr.hpp"
11 #include "phi/compiler_support/inline_variables.hpp"
12 #include "phi/type_traits/add_lvalue_reference.hpp"
13 #include "phi/type_traits/conditional.hpp"
14 #include "phi/type_traits/integral_constant.hpp"
15 #include "phi/type_traits/is_referenceable.hpp"
16 #include "phi/type_traits/is_swappable_with.hpp"
17 
18 DETAIL_PHI_BEGIN_NAMESPACE()
19 
20 template <typename TypeT>
22  : public conditional<is_referenceable<TypeT>::value,
23  is_swappable_with<typename add_lvalue_reference<TypeT>::type,
24  typename add_lvalue_reference<TypeT>::type>,
25  false_type>::type
26 {};
27 
28 template <typename TypeT>
29 struct is_not_swappable : public integral_constant<bool, !is_swappable<TypeT>::value>
30 {};
31 
32 #if PHI_HAS_FEATURE_VARIABLE_TEMPLATE()
33 
34 template <typename TypeT>
35 PHI_INLINE_VARIABLE PHI_CONSTEXPR bool is_swappable_v = is_swappable<TypeT>::value;
36 
37 template <typename TypeT>
38 PHI_INLINE_VARIABLE PHI_CONSTEXPR bool is_not_swappable_v = is_not_swappable<TypeT>::value;
39 
40 #endif
41 
42 DETAIL_PHI_END_NAMESPACE()
43 
44 #endif // INCG_PHI_CORE_TYPE_TRAITS_IS_SWAPPABLE_HPP
Definition: integral_constant.hpp:19
Definition: add_lvalue_reference.hpp:52
Definition: conditional.hpp:13
Definition: is_swappable.hpp:29
Definition: is_swappable_with.hpp:41
Definition: is_swappable.hpp:21
Definition: is_referenceable.hpp:58