File indexing completed on 2025-01-18 09:40:52
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_MOVE_DETAIL_ADDRESSOF_HPP
0011 #define BOOST_MOVE_DETAIL_ADDRESSOF_HPP
0012
0013 #ifndef BOOST_CONFIG_HPP
0014 # include <boost/config.hpp>
0015 #endif
0016
0017 #if defined(BOOST_HAS_PRAGMA_ONCE)
0018 # pragma once
0019 #endif
0020
0021 #include <boost/move/detail/workaround.hpp>
0022
0023 namespace boost {
0024 namespace move_detail {
0025
0026 #if defined(BOOST_MSVC_FULL_VER) && BOOST_MSVC_FULL_VER >= 190024215
0027 #define BOOST_MOVE_HAS_BUILTIN_ADDRESSOF
0028 #elif defined(BOOST_GCC) && BOOST_GCC >= 70000
0029 #define BOOST_MOVE_HAS_BUILTIN_ADDRESSOF
0030 #elif defined(__has_builtin)
0031 #if __has_builtin(__builtin_addressof)
0032 #define BOOST_MOVE_HAS_BUILTIN_ADDRESSOF
0033 #endif
0034 #endif
0035
0036 #ifdef BOOST_MOVE_HAS_BUILTIN_ADDRESSOF
0037
0038 template<class T>
0039 BOOST_MOVE_FORCEINLINE T *addressof( T & v ) BOOST_NOEXCEPT
0040 {
0041 return __builtin_addressof(v);
0042 }
0043
0044 #else
0045
0046 template <typename T>
0047 BOOST_MOVE_FORCEINLINE T* addressof(T& obj)
0048 {
0049 return static_cast<T*>(
0050 static_cast<void*>(
0051 const_cast<char*>(
0052 &reinterpret_cast<const volatile char&>(obj)
0053 )));
0054 }
0055
0056 #endif
0057
0058 }
0059 }
0060
0061 #endif