27#ifndef TEMPTABLE_LOCK_FREE_TYPE_H
28#define TEMPTABLE_LOCK_FREE_TYPE_H
70template <
typename T,
typename V =
void>
73 !std::is_same<T, T>::value,
74 "No always-lock-free property could be found for given type. "
75 "Type provided is probably not a built-in (fundamental) type or a "
76 "pointer which makes it impossible for this particular check to be "
77 "excercised at compile-time.");
89 T, typename
std::enable_if<std::is_class<T>::value and
90 std::is_trivially_copyable<T>::value>
::type> {
91 static_assert(!std::is_same<T, T>::value,
92 "Querying always-lock-free property of trivially-copyable "
93 "classes or structs is not yet implemented!");
99 T, typename
std::enable_if<std::is_pointer<T>::value>
::type> {
100#if (ATOMIC_POINTER_LOCK_FREE == 2)
104 "Pointer type on this platform does not have an "
105 "always-lock-free property. Bailing out ...");
113 typename
std::enable_if<std::is_same<T, long long>::value or
114 std::is_same<T, unsigned long long>::value>
::type> {
115#if (ATOMIC_LLONG_LOCK_FREE == 2)
119 "(unsigned) long long type on this platform does not have an "
120 "always-lock-free property. Bailing out ...");
127 T, typename
std::enable_if<std::is_same<T, long>::value or
128 std::is_same<T, unsigned long>::value>
::type> {
129#if (ATOMIC_LONG_LOCK_FREE == 2)
133 "(unsigned) long type on this platform does not have an "
134 "always-lock-free property. Bailing out ...");
141 T, typename
std::enable_if<std::is_same<T, int>::value or
142 std::is_same<T, unsigned int>::value>
::type> {
143#if (ATOMIC_INT_LOCK_FREE == 2)
147 "(unsigned) int type on this platform does not have an "
148 "always-lock-free property. Bailing out ...");
155 T, typename
std::enable_if<std::is_same<T, short>::value or
156 std::is_same<T, unsigned short>::value>
::type> {
157#if (ATOMIC_SHORT_LOCK_FREE == 2)
161 "(unsigned) short type on this platform does not have an "
162 "always-lock-free property. Bailing out ...");
169 T, typename
std::enable_if<std::is_same<T, char>::value or
170 std::is_same<T, unsigned char>::value>
::type> {
171#if (ATOMIC_CHAR_LOCK_FREE == 2)
175 "(unsigned) char type on this platform does not have an "
176 "always-lock-free property. Bailing out ...");
183 T, typename
std::enable_if<std::is_same<T, bool>::value>
::type> {
184#if (ATOMIC_BOOL_LOCK_FREE == 2)
188 "bool type on this platform does not have an "
189 "always-lock-free property. Bailing out ...");
200template <
typename T,
typename V =
void>
203 !std::is_same<T, T>::value,
204 "No always-lock-free property could be found for given type. "
205 "Type provided is probably not a built-in (fundamental) type or a "
206 "pointer which makes it impossible for this particular check to be "
207 "excercised at compile-time.");
213 T, typename
std::enable_if<std::is_pointer<T>::value>
::type> {
214#if (ATOMIC_POINTER_LOCK_FREE == 2)
218 "Pointer type on this platform does not have an "
219 "always-lock-free property. Bailing out ...");
226 T, typename
std::enable_if<std::is_integral<T>::value>
::type> {
227#if (ATOMIC_LLONG_LOCK_FREE == 2)
228 using Type = std::conditional_t<std::is_unsigned<T>::value,
229 unsigned long long,
long long>;
230#elif (ATOMIC_LONG_LOCK_FREE == 2)
232 std::conditional_t<std::is_unsigned<T>::value,
unsigned long,
long>;
233#elif (ATOMIC_INT_LOCK_FREE == 2)
235 std::conditional_t<std::is_unsigned<T>::value,
unsigned int,
int>;
236#elif (ATOMIC_SHORT_LOCK_FREE == 2)
238 std::conditional_t<std::is_unsigned<T>::value,
unsigned short,
short>;
239#elif (ATOMIC_CHAR_LOCK_FREE == 2)
241 std::conditional_t<std::is_unsigned<T>::value,
unsigned char,
char>;
242#elif (ATOMIC_BOOL_LOCK_FREE == 2)
247 "No suitable always-lock-free type was found for this platform. "
266 template <
typename,
typename =
void>
class TypeSelector =
277template <
typename T,
template <
typename,
typename =
void>
class TypeSelector>
Type
Definition: resource_group_basic_types.h:33
Definition: gcs_xcom_synode.h:64
Definition: allocator.h:45
Alignment
Enum class describing alignment-requirements.
Definition: lock_free_type.h:39
constexpr size_t L1_DCACHE_SIZE
Store L1-dcache size information into the constexpr expression.
Definition: constants.h:82
required string type
Definition: replication_group_member_actions.proto:34
Largest lock-free type selector, a helper utility very much similar to Lock_free_type_selector with t...
Definition: lock_free_type.h:201
typename TypeSelector< T >::Type Type
Definition: lock_free_type.h:279
Lock-free type selector, a helper utility which evaluates during the compile-time whether the given t...
Definition: lock_free_type.h:71
Representation of an atomic type which is guaranteed to be always-lock-free.
Definition: lock_free_type.h:268
typename TypeSelector< T >::Type Type
Definition: lock_free_type.h:269
std::atomic< Type > m_value
Definition: lock_free_type.h:270