26#ifndef TEMPTABLE_LOCK_FREE_TYPE_H
27#define TEMPTABLE_LOCK_FREE_TYPE_H
69template <
typename T,
typename V =
void>
72 !std::is_same<T, T>::value,
73 "No always-lock-free property could be found for given type. "
74 "Type provided is probably not a built-in (fundamental) type or a "
75 "pointer which makes it impossible for this particular check to be "
76 "excercised at compile-time.");
88 T, typename
std::enable_if<std::is_class<T>::value and
89 std::is_trivially_copyable<T>::value>
::type> {
90 static_assert(!std::is_same<T, T>::value,
91 "Querying always-lock-free property of trivially-copyable "
92 "classes or structs is not yet implemented!");
98 T, typename
std::enable_if<std::is_pointer<T>::value>
::type> {
99#if (ATOMIC_POINTER_LOCK_FREE == 2)
103 "Pointer type on this platform does not have an "
104 "always-lock-free property. Bailing out ...");
112 typename
std::enable_if<std::is_same<T, long long>::value or
113 std::is_same<T, unsigned long long>::value>
::type> {
114#if (ATOMIC_LLONG_LOCK_FREE == 2)
118 "(unsigned) long long type on this platform does not have an "
119 "always-lock-free property. Bailing out ...");
126 T, typename
std::enable_if<std::is_same<T, long>::value or
127 std::is_same<T, unsigned long>::value>
::type> {
128#if (ATOMIC_LONG_LOCK_FREE == 2)
132 "(unsigned) long type on this platform does not have an "
133 "always-lock-free property. Bailing out ...");
140 T, typename
std::enable_if<std::is_same<T, int>::value or
141 std::is_same<T, unsigned int>::value>
::type> {
142#if (ATOMIC_INT_LOCK_FREE == 2)
146 "(unsigned) int type on this platform does not have an "
147 "always-lock-free property. Bailing out ...");
154 T, typename
std::enable_if<std::is_same<T, short>::value or
155 std::is_same<T, unsigned short>::value>
::type> {
156#if (ATOMIC_SHORT_LOCK_FREE == 2)
160 "(unsigned) short type on this platform does not have an "
161 "always-lock-free property. Bailing out ...");
168 T, typename
std::enable_if<std::is_same<T, char>::value or
169 std::is_same<T, unsigned char>::value>
::type> {
170#if (ATOMIC_CHAR_LOCK_FREE == 2)
174 "(unsigned) char type on this platform does not have an "
175 "always-lock-free property. Bailing out ...");
182 T, typename
std::enable_if<std::is_same<T, bool>::value>
::type> {
183#if (ATOMIC_BOOL_LOCK_FREE == 2)
187 "bool type on this platform does not have an "
188 "always-lock-free property. Bailing out ...");
199template <
typename T,
typename V =
void>
202 !std::is_same<T, T>::value,
203 "No always-lock-free property could be found for given type. "
204 "Type provided is probably not a built-in (fundamental) type or a "
205 "pointer which makes it impossible for this particular check to be "
206 "excercised at compile-time.");
212 T, typename
std::enable_if<std::is_pointer<T>::value>
::type> {
213#if (ATOMIC_POINTER_LOCK_FREE == 2)
217 "Pointer type on this platform does not have an "
218 "always-lock-free property. Bailing out ...");
225 T, typename
std::enable_if<std::is_integral<T>::value>
::type> {
226#if (ATOMIC_LLONG_LOCK_FREE == 2)
227 using Type = std::conditional_t<std::is_unsigned<T>::value,
228 unsigned long long,
long long>;
229#elif (ATOMIC_LONG_LOCK_FREE == 2)
231 std::conditional_t<std::is_unsigned<T>::value,
unsigned long,
long>;
232#elif (ATOMIC_INT_LOCK_FREE == 2)
234 std::conditional_t<std::is_unsigned<T>::value,
unsigned int,
int>;
235#elif (ATOMIC_SHORT_LOCK_FREE == 2)
237 std::conditional_t<std::is_unsigned<T>::value,
unsigned short,
short>;
238#elif (ATOMIC_CHAR_LOCK_FREE == 2)
240 std::conditional_t<std::is_unsigned<T>::value,
unsigned char,
char>;
241#elif (ATOMIC_BOOL_LOCK_FREE == 2)
246 "No suitable always-lock-free type was found for this platform. "
265 template <
typename,
typename =
void>
class TypeSelector =
276template <
typename T,
template <
typename,
typename =
void>
class TypeSelector>
Type
Definition: resource_group_basic_types.h:32
Definition: varlen_sort.h:174
Definition: allocator.h:44
Alignment
Enum class describing alignment-requirements.
Definition: lock_free_type.h:38
constexpr size_t L1_DCACHE_SIZE
Store L1-dcache size information into the constexpr expression.
Definition: constants.h:81
required string type
Definition: replication_group_member_actions.proto:33
Largest lock-free type selector, a helper utility very much similar to Lock_free_type_selector with t...
Definition: lock_free_type.h:200
typename TypeSelector< T >::Type Type
Definition: lock_free_type.h:278
Lock-free type selector, a helper utility which evaluates during the compile-time whether the given t...
Definition: lock_free_type.h:70
Representation of an atomic type which is guaranteed to be always-lock-free.
Definition: lock_free_type.h:267
typename TypeSelector< T >::Type Type
Definition: lock_free_type.h:268
std::atomic< Type > m_value
Definition: lock_free_type.h:269