mirror of
https://github.com/boostorg/core.git
synced 2025-07-30 21:07:22 +02:00
Rename detail identifiers in addressof
This commit is contained in:
@ -49,20 +49,20 @@ namespace boost {
|
|||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
class addressof_ref {
|
class addrof_ref {
|
||||||
public:
|
public:
|
||||||
BOOST_FORCEINLINE addressof_ref(T& o) BOOST_NOEXCEPT
|
BOOST_FORCEINLINE addrof_ref(T& o) BOOST_NOEXCEPT
|
||||||
: o_(o) { }
|
: o_(o) { }
|
||||||
BOOST_FORCEINLINE operator T&() const BOOST_NOEXCEPT {
|
BOOST_FORCEINLINE operator T&() const BOOST_NOEXCEPT {
|
||||||
return o_;
|
return o_;
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
addressof_ref& operator=(const addressof_ref&);
|
addrof_ref& operator=(const addrof_ref&);
|
||||||
T& o_;
|
T& o_;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
struct address_of {
|
struct addrof {
|
||||||
static BOOST_FORCEINLINE T* get(T& o, long) BOOST_NOEXCEPT {
|
static BOOST_FORCEINLINE T* get(T& o, long) BOOST_NOEXCEPT {
|
||||||
return reinterpret_cast<T*>(&
|
return reinterpret_cast<T*>(&
|
||||||
const_cast<char&>(reinterpret_cast<const volatile char&>(o)));
|
const_cast<char&>(reinterpret_cast<const volatile char&>(o)));
|
||||||
@ -76,38 +76,38 @@ struct address_of {
|
|||||||
#if !defined(BOOST_NO_CXX11_DECLTYPE) && \
|
#if !defined(BOOST_NO_CXX11_DECLTYPE) && \
|
||||||
(defined(__INTEL_COMPILER) || \
|
(defined(__INTEL_COMPILER) || \
|
||||||
(defined(__clang__) && !defined(_LIBCPP_VERSION)))
|
(defined(__clang__) && !defined(_LIBCPP_VERSION)))
|
||||||
typedef decltype(nullptr) addressof_null_t;
|
typedef decltype(nullptr) addrof_null_t;
|
||||||
#else
|
#else
|
||||||
typedef std::nullptr_t addressof_null_t;
|
typedef std::nullptr_t addrof_null_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct address_of<addressof_null_t> {
|
struct addrof<addrof_null_t> {
|
||||||
typedef addressof_null_t type;
|
typedef addrof_null_t type;
|
||||||
static BOOST_FORCEINLINE type* get(type& o, int) BOOST_NOEXCEPT {
|
static BOOST_FORCEINLINE type* get(type& o, int) BOOST_NOEXCEPT {
|
||||||
return &o;
|
return &o;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct address_of<const addressof_null_t> {
|
struct addrof<const addrof_null_t> {
|
||||||
typedef const addressof_null_t type;
|
typedef const addrof_null_t type;
|
||||||
static BOOST_FORCEINLINE type* get(type& o, int) BOOST_NOEXCEPT {
|
static BOOST_FORCEINLINE type* get(type& o, int) BOOST_NOEXCEPT {
|
||||||
return &o;
|
return &o;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct address_of<volatile addressof_null_t> {
|
struct addrof<volatile addrof_null_t> {
|
||||||
typedef volatile addressof_null_t type;
|
typedef volatile addrof_null_t type;
|
||||||
static BOOST_FORCEINLINE type* get(type& o, int) BOOST_NOEXCEPT {
|
static BOOST_FORCEINLINE type* get(type& o, int) BOOST_NOEXCEPT {
|
||||||
return &o;
|
return &o;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct address_of<const volatile addressof_null_t> {
|
struct addrof<const volatile addrof_null_t> {
|
||||||
typedef const volatile addressof_null_t type;
|
typedef const volatile addrof_null_t type;
|
||||||
static BOOST_FORCEINLINE type* get(type& o, int) BOOST_NOEXCEPT {
|
static BOOST_FORCEINLINE type* get(type& o, int) BOOST_NOEXCEPT {
|
||||||
return &o;
|
return &o;
|
||||||
}
|
}
|
||||||
@ -127,10 +127,9 @@ addressof(T& o) BOOST_NOEXCEPT
|
|||||||
{
|
{
|
||||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) || \
|
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) || \
|
||||||
BOOST_WORKAROUND(__SUNPRO_CC, <= 0x5120)
|
BOOST_WORKAROUND(__SUNPRO_CC, <= 0x5120)
|
||||||
return boost::detail::address_of<T>::get(o, 0);
|
return boost::detail::addrof<T>::get(o, 0);
|
||||||
#else
|
#else
|
||||||
return boost::detail::address_of<T>::
|
return boost::detail::addrof<T>::get(boost::detail::addrof_ref<T>(o), 0);
|
||||||
get(boost::detail::addressof_ref<T>(o), 0);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,14 +137,14 @@ addressof(T& o) BOOST_NOEXCEPT
|
|||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
struct addressof_result {
|
struct addrof_result {
|
||||||
typedef T* type;
|
typedef T* type;
|
||||||
};
|
};
|
||||||
|
|
||||||
} /* detail */
|
} /* detail */
|
||||||
|
|
||||||
template<class T, std::size_t N>
|
template<class T, std::size_t N>
|
||||||
BOOST_FORCEINLINE typename detail::addressof_result<T[N]>::type
|
BOOST_FORCEINLINE typename boost::detail::addrof_result<T[N]>::type
|
||||||
addressof(T (&o)[N]) BOOST_NOEXCEPT
|
addressof(T (&o)[N]) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
return &o;
|
return &o;
|
||||||
@ -171,79 +170,79 @@ const T (*addressof(const T (&o)[N]) BOOST_NOEXCEPT)[N]
|
|||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
T addressof_declval() BOOST_NOEXCEPT;
|
T addrof_declval() BOOST_NOEXCEPT;
|
||||||
|
|
||||||
template<class>
|
template<class>
|
||||||
struct addressof_void {
|
struct addrof_void {
|
||||||
typedef void type;
|
typedef void type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class T, class E = void>
|
template<class T, class E = void>
|
||||||
struct addressof_member_operator {
|
struct addrof_member_operator {
|
||||||
static constexpr bool value = false;
|
static constexpr bool value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
struct addressof_member_operator<T, typename
|
struct addrof_member_operator<T, typename
|
||||||
addressof_void<decltype(addressof_declval<T&>().operator&())>::type> {
|
addrof_void<decltype(addrof_declval<T&>().operator&())>::type> {
|
||||||
static constexpr bool value = true;
|
static constexpr bool value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if BOOST_WORKAROUND(BOOST_INTEL, < 1600)
|
#if BOOST_WORKAROUND(BOOST_INTEL, < 1600)
|
||||||
struct addressof_addressable { };
|
struct addrof_addressable { };
|
||||||
|
|
||||||
addressof_addressable*
|
addrof_addressable*
|
||||||
operator&(addressof_addressable&) BOOST_NOEXCEPT;
|
operator&(addrof_addressable&) BOOST_NOEXCEPT;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template<class T, class E = void>
|
template<class T, class E = void>
|
||||||
struct addressof_non_member_operator {
|
struct addrof_non_member_operator {
|
||||||
static constexpr bool value = false;
|
static constexpr bool value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
struct addressof_non_member_operator<T, typename
|
struct addrof_non_member_operator<T, typename
|
||||||
addressof_void<decltype(operator&(addressof_declval<T&>()))>::type> {
|
addrof_void<decltype(operator&(addrof_declval<T&>()))>::type> {
|
||||||
static constexpr bool value = true;
|
static constexpr bool value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class T, class E = void>
|
template<class T, class E = void>
|
||||||
struct addressof_expression {
|
struct addrof_expression {
|
||||||
static constexpr bool value = false;
|
static constexpr bool value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
struct addressof_expression<T,
|
struct addrof_expression<T,
|
||||||
typename addressof_void<decltype(&addressof_declval<T&>())>::type> {
|
typename addrof_void<decltype(&addrof_declval<T&>())>::type> {
|
||||||
static constexpr bool value = true;
|
static constexpr bool value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
struct addressof_is_constexpr {
|
struct addrof_is_constexpr {
|
||||||
static constexpr bool value = addressof_expression<T>::value &&
|
static constexpr bool value = addrof_expression<T>::value &&
|
||||||
!addressof_member_operator<T>::value &&
|
!addrof_member_operator<T>::value &&
|
||||||
!addressof_non_member_operator<T>::value;
|
!addrof_non_member_operator<T>::value;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<bool E, class T>
|
template<bool E, class T>
|
||||||
struct addressof_if { };
|
struct addrof_if { };
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
struct addressof_if<true, T> {
|
struct addrof_if<true, T> {
|
||||||
typedef T* type;
|
typedef T* type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
BOOST_FORCEINLINE
|
BOOST_FORCEINLINE
|
||||||
typename addressof_if<!addressof_is_constexpr<T>::value, T>::type
|
typename addrof_if<!addrof_is_constexpr<T>::value, T>::type
|
||||||
addressof(T& o) BOOST_NOEXCEPT
|
addressof(T& o) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
return address_of<T>::get(addressof_ref<T>(o), 0);
|
return addrof<T>::get(addrof_ref<T>(o), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
constexpr BOOST_FORCEINLINE
|
constexpr BOOST_FORCEINLINE
|
||||||
typename addressof_if<addressof_is_constexpr<T>::value, T>::type
|
typename addrof_if<addrof_is_constexpr<T>::value, T>::type
|
||||||
addressof(T& o) BOOST_NOEXCEPT
|
addressof(T& o) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
return &o;
|
return &o;
|
||||||
@ -255,7 +254,7 @@ template<class T>
|
|||||||
constexpr BOOST_FORCEINLINE T*
|
constexpr BOOST_FORCEINLINE T*
|
||||||
addressof(T& o) BOOST_NOEXCEPT
|
addressof(T& o) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
return detail::addressof(o);
|
return boost::detail::addressof(o);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user