template<typename _IntTp>
struct __atomic_base;
- /// atomic_char
- typedef __atomic_base<char> atomic_char;
-
- /// atomic_schar
- typedef __atomic_base<signed char> atomic_schar;
-
- /// atomic_uchar
- typedef __atomic_base<unsigned char> atomic_uchar;
-
- /// atomic_short
- typedef __atomic_base<short> atomic_short;
-
- /// atomic_ushort
- typedef __atomic_base<unsigned short> atomic_ushort;
-
- /// atomic_int
- typedef __atomic_base<int> atomic_int;
-
- /// atomic_uint
- typedef __atomic_base<unsigned int> atomic_uint;
-
- /// atomic_long
- typedef __atomic_base<long> atomic_long;
-
- /// atomic_ulong
- typedef __atomic_base<unsigned long> atomic_ulong;
-
- /// atomic_llong
- typedef __atomic_base<long long> atomic_llong;
-
- /// atomic_ullong
- typedef __atomic_base<unsigned long long> atomic_ullong;
-
- /// atomic_wchar_t
- typedef __atomic_base<wchar_t> atomic_wchar_t;
-
- /// atomic_char16_t
- typedef __atomic_base<char16_t> atomic_char16_t;
-
- /// atomic_char32_t
- typedef __atomic_base<char32_t> atomic_char32_t;
-
- /// atomic_char32_t
- typedef __atomic_base<char32_t> atomic_char32_t;
-
-
- /// atomic_int_least8_t
- typedef __atomic_base<int_least8_t> atomic_int_least8_t;
-
- /// atomic_uint_least8_t
- typedef __atomic_base<uint_least8_t> atomic_uint_least8_t;
-
- /// atomic_int_least16_t
- typedef __atomic_base<int_least16_t> atomic_int_least16_t;
-
- /// atomic_uint_least16_t
- typedef __atomic_base<uint_least16_t> atomic_uint_least16_t;
-
- /// atomic_int_least32_t
- typedef __atomic_base<int_least32_t> atomic_int_least32_t;
-
- /// atomic_uint_least32_t
- typedef __atomic_base<uint_least32_t> atomic_uint_least32_t;
-
- /// atomic_int_least64_t
- typedef __atomic_base<int_least64_t> atomic_int_least64_t;
-
- /// atomic_uint_least64_t
- typedef __atomic_base<uint_least64_t> atomic_uint_least64_t;
-
-
- /// atomic_int_fast8_t
- typedef __atomic_base<int_fast8_t> atomic_int_fast8_t;
-
- /// atomic_uint_fast8_t
- typedef __atomic_base<uint_fast8_t> atomic_uint_fast8_t;
-
- /// atomic_int_fast16_t
- typedef __atomic_base<int_fast16_t> atomic_int_fast16_t;
-
- /// atomic_uint_fast16_t
- typedef __atomic_base<uint_fast16_t> atomic_uint_fast16_t;
-
- /// atomic_int_fast32_t
- typedef __atomic_base<int_fast32_t> atomic_int_fast32_t;
-
- /// atomic_uint_fast32_t
- typedef __atomic_base<uint_fast32_t> atomic_uint_fast32_t;
-
- /// atomic_int_fast64_t
- typedef __atomic_base<int_fast64_t> atomic_int_fast64_t;
-
- /// atomic_uint_fast64_t
- typedef __atomic_base<uint_fast64_t> atomic_uint_fast64_t;
-
-
- /// atomic_intptr_t
- typedef __atomic_base<intptr_t> atomic_intptr_t;
-
- /// atomic_uintptr_t
- typedef __atomic_base<uintptr_t> atomic_uintptr_t;
-
- /// atomic_size_t
- typedef __atomic_base<size_t> atomic_size_t;
-
- /// atomic_intmax_t
- typedef __atomic_base<intmax_t> atomic_intmax_t;
-
- /// atomic_uintmax_t
- typedef __atomic_base<uintmax_t> atomic_uintmax_t;
-
- /// atomic_ptrdiff_t
- typedef __atomic_base<ptrdiff_t> atomic_ptrdiff_t;
-
#define ATOMIC_VAR_INIT(_VI) { _VI }
* @{
*/
- /// atomic_bool
+ template<typename _Tp>
+ struct atomic;
+
+ /// atomic<bool>
// NB: No operators or fetch-operations for this type.
- struct atomic_bool
+ template<>
+ struct atomic<bool>
{
private:
__atomic_base<bool> _M_base;
public:
- atomic_bool() noexcept = default;
- ~atomic_bool() noexcept = default;
- atomic_bool(const atomic_bool&) = delete;
- atomic_bool& operator=(const atomic_bool&) = delete;
- atomic_bool& operator=(const atomic_bool&) volatile = delete;
+ atomic() noexcept = default;
+ ~atomic() noexcept = default;
+ atomic(const atomic&) = delete;
+ atomic& operator=(const atomic&) = delete;
+ atomic& operator=(const atomic&) volatile = delete;
- constexpr atomic_bool(bool __i) noexcept : _M_base(__i) { }
+ constexpr atomic(bool __i) noexcept : _M_base(__i) { }
bool
operator=(bool __i) noexcept
};
- /// Explicit specialization for bool.
- template<>
- struct atomic<bool> : public atomic_bool
- {
- typedef bool __integral_type;
- typedef atomic_bool __base_type;
-
- atomic() noexcept = default;
- ~atomic() noexcept = default;
- atomic(const atomic&) = delete;
- atomic& operator=(const atomic&) = delete;
- atomic& operator=(const atomic&) volatile = delete;
-
- constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { }
-
- using __base_type::operator __integral_type;
- using __base_type::operator=;
- };
-
/// Explicit specialization for char.
template<>
- struct atomic<char> : public atomic_char
+ struct atomic<char> : __atomic_base<char>
{
typedef char __integral_type;
- typedef atomic_char __base_type;
+ typedef __atomic_base<char> __base_type;
atomic() noexcept = default;
~atomic() noexcept = default;
/// Explicit specialization for signed char.
template<>
- struct atomic<signed char> : public atomic_schar
+ struct atomic<signed char> : __atomic_base<signed char>
{
typedef signed char __integral_type;
- typedef atomic_schar __base_type;
+ typedef __atomic_base<signed char> __base_type;
atomic() noexcept= default;
~atomic() noexcept = default;
/// Explicit specialization for unsigned char.
template<>
- struct atomic<unsigned char> : public atomic_uchar
+ struct atomic<unsigned char> : __atomic_base<unsigned char>
{
typedef unsigned char __integral_type;
- typedef atomic_uchar __base_type;
+ typedef __atomic_base<unsigned char> __base_type;
atomic() noexcept= default;
~atomic() noexcept = default;
/// Explicit specialization for short.
template<>
- struct atomic<short> : public atomic_short
+ struct atomic<short> : __atomic_base<short>
{
typedef short __integral_type;
- typedef atomic_short __base_type;
+ typedef __atomic_base<short> __base_type;
atomic() noexcept = default;
~atomic() noexcept = default;
/// Explicit specialization for unsigned short.
template<>
- struct atomic<unsigned short> : public atomic_ushort
+ struct atomic<unsigned short> : __atomic_base<unsigned short>
{
typedef unsigned short __integral_type;
- typedef atomic_ushort __base_type;
+ typedef __atomic_base<unsigned short> __base_type;
atomic() noexcept = default;
~atomic() noexcept = default;
/// Explicit specialization for int.
template<>
- struct atomic<int> : atomic_int
+ struct atomic<int> : __atomic_base<int>
{
typedef int __integral_type;
- typedef atomic_int __base_type;
+ typedef __atomic_base<int> __base_type;
atomic() noexcept = default;
~atomic() noexcept = default;
/// Explicit specialization for unsigned int.
template<>
- struct atomic<unsigned int> : public atomic_uint
+ struct atomic<unsigned int> : __atomic_base<unsigned int>
{
typedef unsigned int __integral_type;
- typedef atomic_uint __base_type;
+ typedef __atomic_base<unsigned int> __base_type;
atomic() noexcept = default;
~atomic() noexcept = default;
/// Explicit specialization for long.
template<>
- struct atomic<long> : public atomic_long
+ struct atomic<long> : __atomic_base<long>
{
typedef long __integral_type;
- typedef atomic_long __base_type;
+ typedef __atomic_base<long> __base_type;
atomic() noexcept = default;
~atomic() noexcept = default;
/// Explicit specialization for unsigned long.
template<>
- struct atomic<unsigned long> : public atomic_ulong
+ struct atomic<unsigned long> : __atomic_base<unsigned long>
{
typedef unsigned long __integral_type;
- typedef atomic_ulong __base_type;
+ typedef __atomic_base<unsigned long> __base_type;
atomic() noexcept = default;
~atomic() noexcept = default;
/// Explicit specialization for long long.
template<>
- struct atomic<long long> : public atomic_llong
+ struct atomic<long long> : __atomic_base<long long>
{
typedef long long __integral_type;
- typedef atomic_llong __base_type;
+ typedef __atomic_base<long long> __base_type;
atomic() noexcept = default;
~atomic() noexcept = default;
/// Explicit specialization for unsigned long long.
template<>
- struct atomic<unsigned long long> : public atomic_ullong
+ struct atomic<unsigned long long> : __atomic_base<unsigned long long>
{
typedef unsigned long long __integral_type;
- typedef atomic_ullong __base_type;
+ typedef __atomic_base<unsigned long long> __base_type;
atomic() noexcept = default;
~atomic() noexcept = default;
/// Explicit specialization for wchar_t.
template<>
- struct atomic<wchar_t> : public atomic_wchar_t
+ struct atomic<wchar_t> : __atomic_base<wchar_t>
{
typedef wchar_t __integral_type;
- typedef atomic_wchar_t __base_type;
+ typedef __atomic_base<wchar_t> __base_type;
atomic() noexcept = default;
~atomic() noexcept = default;
/// Explicit specialization for char16_t.
template<>
- struct atomic<char16_t> : public atomic_char16_t
+ struct atomic<char16_t> : __atomic_base<char16_t>
{
typedef char16_t __integral_type;
- typedef atomic_char16_t __base_type;
+ typedef __atomic_base<char16_t> __base_type;
atomic() noexcept = default;
~atomic() noexcept = default;
/// Explicit specialization for char32_t.
template<>
- struct atomic<char32_t> : public atomic_char32_t
+ struct atomic<char32_t> : __atomic_base<char32_t>
{
typedef char32_t __integral_type;
- typedef atomic_char32_t __base_type;
+ typedef __atomic_base<char32_t> __base_type;
atomic() noexcept = default;
~atomic() noexcept = default;
};
+ /// atomic_bool
+ typedef atomic<bool> atomic_bool;
+
+ /// atomic_char
+ typedef atomic<char> atomic_char;
+
+ /// atomic_schar
+ typedef atomic<signed char> atomic_schar;
+
+ /// atomic_uchar
+ typedef atomic<unsigned char> atomic_uchar;
+
+ /// atomic_short
+ typedef atomic<short> atomic_short;
+
+ /// atomic_ushort
+ typedef atomic<unsigned short> atomic_ushort;
+
+ /// atomic_int
+ typedef atomic<int> atomic_int;
+
+ /// atomic_uint
+ typedef atomic<unsigned int> atomic_uint;
+
+ /// atomic_long
+ typedef atomic<long> atomic_long;
+
+ /// atomic_ulong
+ typedef atomic<unsigned long> atomic_ulong;
+
+ /// atomic_llong
+ typedef atomic<long long> atomic_llong;
+
+ /// atomic_ullong
+ typedef atomic<unsigned long long> atomic_ullong;
+
+ /// atomic_wchar_t
+ typedef atomic<wchar_t> atomic_wchar_t;
+
+ /// atomic_char16_t
+ typedef atomic<char16_t> atomic_char16_t;
+
+ /// atomic_char32_t
+ typedef atomic<char32_t> atomic_char32_t;
+
+
+ /// atomic_int_least8_t
+ typedef atomic<int_least8_t> atomic_int_least8_t;
+
+ /// atomic_uint_least8_t
+ typedef atomic<uint_least8_t> atomic_uint_least8_t;
+
+ /// atomic_int_least16_t
+ typedef atomic<int_least16_t> atomic_int_least16_t;
+
+ /// atomic_uint_least16_t
+ typedef atomic<uint_least16_t> atomic_uint_least16_t;
+
+ /// atomic_int_least32_t
+ typedef atomic<int_least32_t> atomic_int_least32_t;
+
+ /// atomic_uint_least32_t
+ typedef atomic<uint_least32_t> atomic_uint_least32_t;
+
+ /// atomic_int_least64_t
+ typedef atomic<int_least64_t> atomic_int_least64_t;
+
+ /// atomic_uint_least64_t
+ typedef atomic<uint_least64_t> atomic_uint_least64_t;
+
+
+ /// atomic_int_fast8_t
+ typedef atomic<int_fast8_t> atomic_int_fast8_t;
+
+ /// atomic_uint_fast8_t
+ typedef atomic<uint_fast8_t> atomic_uint_fast8_t;
+
+ /// atomic_int_fast16_t
+ typedef atomic<int_fast16_t> atomic_int_fast16_t;
+
+ /// atomic_uint_fast16_t
+ typedef atomic<uint_fast16_t> atomic_uint_fast16_t;
+
+ /// atomic_int_fast32_t
+ typedef atomic<int_fast32_t> atomic_int_fast32_t;
+
+ /// atomic_uint_fast32_t
+ typedef atomic<uint_fast32_t> atomic_uint_fast32_t;
+
+ /// atomic_int_fast64_t
+ typedef atomic<int_fast64_t> atomic_int_fast64_t;
+
+ /// atomic_uint_fast64_t
+ typedef atomic<uint_fast64_t> atomic_uint_fast64_t;
+
+
+ /// atomic_intptr_t
+ typedef atomic<intptr_t> atomic_intptr_t;
+
+ /// atomic_uintptr_t
+ typedef atomic<uintptr_t> atomic_uintptr_t;
+
+ /// atomic_size_t
+ typedef atomic<size_t> atomic_size_t;
+
+ /// atomic_intmax_t
+ typedef atomic<intmax_t> atomic_intmax_t;
+
+ /// atomic_uintmax_t
+ typedef atomic<uintmax_t> atomic_uintmax_t;
+
+ /// atomic_ptrdiff_t
+ typedef atomic<ptrdiff_t> atomic_ptrdiff_t;
+
+
// Function definitions, atomic_flag operations.
inline bool
atomic_flag_test_and_set_explicit(atomic_flag* __a,