siplasplas
A library for C++ reflection and introspection
valuesemantics.hpp
1 #ifndef SIPLASPLAS_TYPEERASURE_CONCEPTS_VALUESEMANTICS_HPP
2 #define SIPLASPLAS_TYPEERASURE_CONCEPTS_VALUESEMANTICS_HPP
3 
4 #include "concept.hpp"
5 #include <type_traits>
6 
12 namespace cpp
13 {
14 
15 namespace concepts
16 {
17 
27 template<typename T>
29  std::is_default_constructible<T>::value,
30  std::is_nothrow_default_constructible<T>::value
31 > {};
32 
33 
45 template<typename T, typename... Args>
46 class Constructible : public Concept<
47  std::is_constructible<T, Args...>::value,
48  std::is_nothrow_constructible<T, Args...>::value
49 > {};
50 
51 
61 template<typename T>
62 class CopyConstructible : public Concept<
63  std::is_copy_constructible<T>::value,
64  std::is_nothrow_copy_constructible<T>::value
65 > {};
66 
67 
77 template<typename T>
78 class MoveConstructible : public Concept<
79  std::is_move_constructible<T>::value,
80  std::is_nothrow_move_constructible<T>::value
81 > {};
82 
83 
94 template<typename T, typename U>
95 class Assignable : public Concept<
96 #ifdef _MSC_VER
97  false,
98  std::is_nothrow_assignable<T, U>::value
99 #else
100  std::is_assignable<T, U>::value,
101  std::is_nothrow_assignable<T, U>::value
102 #endif // _MSC_VER
103 > {};
104 
105 
115 template<typename T>
116 class CopyAssignable : public Concept<
117  std::is_copy_assignable<T>::value,
118  std::is_nothrow_copy_assignable<T>::value
119 > {};
120 
121 
131 template<typename T>
132 class MoveAssignable : public Concept<
133  std::is_move_assignable<T>::value,
134  std::is_nothrow_move_assignable<T>::value
135 > {};
136 
137 
147 template<typename T>
148 class Destructible : public Concept<
149  std::is_destructible<T>::value,
150  std::is_nothrow_destructible<T>::value
151 > {};
152 
153 }
154 
155 }
156 
157 #endif // SIPLASPLAS_TYPEERASURE_CONCEPTS_VALUESEMANTICS_HPP
Checks if a type satisfies the constructible concept with the given constructor arguments.
Definition: valuesemantics.hpp:46
Checks if a type satisfies the move assignable concept
Definition: valuesemantics.hpp:132
Checks if a type satisfies the destructible concept
Definition: valuesemantics.hpp:148
Definition: canary_allocator.hpp:7
Checks if a type satisfies the default constructible concept
Definition: valuesemantics.hpp:28
Checks if a type satisfies the assignable concept
Definition: valuesemantics.hpp:95
Checks if a type satisfies the copy assignable concept
Definition: valuesemantics.hpp:116
Checks if a type satisfies the copy constructible concept
Definition: valuesemantics.hpp:62
Checks if a type satisfies the move constructible concept
Definition: valuesemantics.hpp:78
Represents a concept.
Definition: concept.hpp:28