| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| #ifndef _LIBCUDACXX___MEMORY_ADDRESSOF_H |
| #define _LIBCUDACXX___MEMORY_ADDRESSOF_H |
|
|
| #ifndef __cuda_std__ |
| #include <__config> |
| #endif |
|
|
| #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) |
| # pragma GCC system_header |
| #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) |
| # pragma clang system_header |
| #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) |
| # pragma system_header |
| #endif |
|
|
| _LIBCUDACXX_BEGIN_NAMESPACE_STD |
|
|
| |
| |
| #if defined(_LIBCUDACXX_ADDRESSOF) |
|
|
| template <class _Tp> |
| inline _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 |
| _LIBCUDACXX_NO_CFI _LIBCUDACXX_INLINE_VISIBILITY |
| _Tp* |
| addressof(_Tp& __x) noexcept |
| { |
| return __builtin_addressof(__x); |
| } |
|
|
| #else |
|
|
| template <class _Tp> |
| inline _LIBCUDACXX_NO_CFI _LIBCUDACXX_INLINE_VISIBILITY |
| _Tp* |
| addressof(_Tp& __x) noexcept |
| { |
| return reinterpret_cast<_Tp *>( |
| const_cast<char *>(&reinterpret_cast<const volatile char &>(__x))); |
| } |
|
|
| #endif |
|
|
| #if defined(_LIBCUDACXX_HAS_OBJC_ARC) && !defined(_LIBCUDACXX_PREDEFINED_OBJC_ARC_ADDRESSOF) |
| |
| |
| |
| |
| template <class _Tp> |
| inline _LIBCUDACXX_INLINE_VISIBILITY |
| __strong _Tp* |
| addressof(__strong _Tp& __x) noexcept |
| { |
| return &__x; |
| } |
|
|
| #ifdef _LIBCUDACXX_HAS_OBJC_ARC_WEAK |
| template <class _Tp> |
| inline _LIBCUDACXX_INLINE_VISIBILITY |
| __weak _Tp* |
| addressof(__weak _Tp& __x) noexcept |
| { |
| return &__x; |
| } |
| #endif |
|
|
| template <class _Tp> |
| inline _LIBCUDACXX_INLINE_VISIBILITY |
| __autoreleasing _Tp* |
| addressof(__autoreleasing _Tp& __x) noexcept |
| { |
| return &__x; |
| } |
|
|
| template <class _Tp> |
| inline _LIBCUDACXX_INLINE_VISIBILITY |
| __unsafe_unretained _Tp* |
| addressof(__unsafe_unretained _Tp& __x) noexcept |
| { |
| return &__x; |
| } |
| #endif |
|
|
| template <class _Tp> _Tp* addressof(const _Tp&&) noexcept = delete; |
|
|
| _LIBCUDACXX_END_NAMESPACE_STD |
|
|
| #endif |
|
|