Struct atomic_invalid_type


#include <include/EASTL/internal/atomic/atomic_asserts.h>

template <typename T>
struct atomic_invalid_type


No description yet.


Lines 51-66 in include/EASTL/internal/atomic/atomic_asserts.h.

template <typename T>
struct atomic_invalid_type
     * class Test { int i; int j; int k; }; sizeof(Test) == 96 bits
     * std::atomic allows non-primitive types to be used for the template type.
     * This causes the api to degrade to locking for types that cannot fit into the lockfree size
     * of the target platform such as std::atomic<Test> leading to performance traps.
     * If this static_assert() fired, this means your template type T is larger than any atomic instruction
     * supported on the given platform.
    static_assert(!eastl::is_same<T, T>::value, "eastl::atomic<T> : invalid template type T!");

Add Discussion as Guest

Log in