File indexing completed on 2025-12-16 09:43:43
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef BOOST_ATOMIC_DETAIL_ADDRESSOF_HPP_INCLUDED_
0016 #define BOOST_ATOMIC_DETAIL_ADDRESSOF_HPP_INCLUDED_
0017
0018 #include <boost/atomic/detail/config.hpp>
0019 #include <boost/atomic/detail/header.hpp>
0020
0021 #ifdef BOOST_HAS_PRAGMA_ONCE
0022 #pragma once
0023 #endif
0024
0025
0026 #if defined(BOOST_MSVC_FULL_VER) && BOOST_MSVC_FULL_VER >= 190024215
0027 #define BOOST_ATOMIC_DETAIL_HAS_BUILTIN_ADDRESSOF
0028 #elif defined(BOOST_GCC) && BOOST_GCC >= 70000
0029 #define BOOST_ATOMIC_DETAIL_HAS_BUILTIN_ADDRESSOF
0030 #elif defined(__has_builtin)
0031 #if __has_builtin(__builtin_addressof)
0032 #define BOOST_ATOMIC_DETAIL_HAS_BUILTIN_ADDRESSOF
0033 #endif
0034 #endif
0035
0036 namespace boost {
0037 namespace atomics {
0038 namespace detail {
0039
0040 template< typename T >
0041 BOOST_FORCEINLINE
0042 #if defined(BOOST_ATOMIC_DETAIL_HAS_BUILTIN_ADDRESSOF)
0043 BOOST_CONSTEXPR
0044 #endif
0045 T* addressof(T& value) BOOST_NOEXCEPT
0046 {
0047 #if defined(BOOST_ATOMIC_DETAIL_HAS_BUILTIN_ADDRESSOF)
0048 return __builtin_addressof(value);
0049 #else
0050
0051
0052
0053
0054 struct opaque_type;
0055 return reinterpret_cast< T* >(&const_cast< opaque_type& >(reinterpret_cast< const volatile opaque_type& >(value)));
0056 #endif
0057 }
0058
0059 }
0060 }
0061 }
0062
0063 #include <boost/atomic/detail/footer.hpp>
0064
0065 #endif