diff --git a/include/boost/memory_order.hpp b/include/boost/memory_order.hpp index ba7d1cd..f3268e7 100644 --- a/include/boost/memory_order.hpp +++ b/include/boost/memory_order.hpp @@ -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 #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