mirror of
https://github.com/boostorg/atomic.git
synced 2026-01-19 04:02:09 +00:00
Make memory_order unconditionally a C++11 scoped enum.
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
// Defines enum boost::memory_order per the C++0x working draft
|
||||
//
|
||||
// Copyright (c) 2008, 2009 Peter Dimov
|
||||
// Copyright (c) 2018 Andrey Semashev
|
||||
// Copyright (c) 2018, 2025 Andrey Semashev
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -15,7 +15,7 @@
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if defined(BOOST_HAS_PRAGMA_ONCE)
|
||||
# pragma once
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
@@ -42,8 +42,6 @@ namespace boost
|
||||
// efficiently in compare_exchange methods.
|
||||
//
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_SCOPED_ENUMS)
|
||||
|
||||
enum class memory_order : unsigned int
|
||||
{
|
||||
relaxed = 0,
|
||||
@@ -54,28 +52,12 @@ enum class memory_order : unsigned int
|
||||
seq_cst = 14 // acq_rel | 8
|
||||
};
|
||||
|
||||
BOOST_INLINE_VARIABLE BOOST_CONSTEXPR_OR_CONST memory_order memory_order_relaxed = memory_order::relaxed;
|
||||
BOOST_INLINE_VARIABLE BOOST_CONSTEXPR_OR_CONST memory_order memory_order_consume = memory_order::consume;
|
||||
BOOST_INLINE_VARIABLE BOOST_CONSTEXPR_OR_CONST memory_order memory_order_acquire = memory_order::acquire;
|
||||
BOOST_INLINE_VARIABLE BOOST_CONSTEXPR_OR_CONST memory_order memory_order_release = memory_order::release;
|
||||
BOOST_INLINE_VARIABLE BOOST_CONSTEXPR_OR_CONST memory_order memory_order_acq_rel = memory_order::acq_rel;
|
||||
BOOST_INLINE_VARIABLE BOOST_CONSTEXPR_OR_CONST memory_order memory_order_seq_cst = memory_order::seq_cst;
|
||||
|
||||
#undef BOOST_MEMORY_ORDER_INLINE_VARIABLE
|
||||
|
||||
#else // !defined(BOOST_NO_CXX11_SCOPED_ENUMS)
|
||||
|
||||
enum memory_order
|
||||
{
|
||||
memory_order_relaxed = 0,
|
||||
memory_order_consume = 1,
|
||||
memory_order_acquire = 2,
|
||||
memory_order_release = 4,
|
||||
memory_order_acq_rel = 6, // acquire | release
|
||||
memory_order_seq_cst = 14 // acq_rel | 8
|
||||
};
|
||||
|
||||
#endif // !defined(BOOST_NO_CXX11_SCOPED_ENUMS)
|
||||
BOOST_INLINE_VARIABLE constexpr memory_order memory_order_relaxed = memory_order::relaxed;
|
||||
BOOST_INLINE_VARIABLE constexpr memory_order memory_order_consume = memory_order::consume;
|
||||
BOOST_INLINE_VARIABLE constexpr memory_order memory_order_acquire = memory_order::acquire;
|
||||
BOOST_INLINE_VARIABLE constexpr memory_order memory_order_release = memory_order::release;
|
||||
BOOST_INLINE_VARIABLE constexpr memory_order memory_order_acq_rel = memory_order::acq_rel;
|
||||
BOOST_INLINE_VARIABLE constexpr memory_order memory_order_seq_cst = memory_order::seq_cst;
|
||||
|
||||
} // namespace boost
|
||||
|
||||
|
||||
Reference in New Issue
Block a user