| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| #ifndef _LIBCUDACXX__LIBCUDACXX_NO_UNIQUE_ADDRESS_HPP |
| #define _LIBCUDACXX__LIBCUDACXX_NO_UNIQUE_ADDRESS_HPP |
|
|
| #ifndef __cuda_std__ |
| #include <__config> |
| #endif |
|
|
| #include "../__mdspan/macros.h" |
| #include "../__type_traits/enable_if.h" |
| #include "../__type_traits/is_empty.h" |
| #include "../__type_traits/is_trivially_destructible.h" |
| #include "../__utility/move.h" |
|
|
| #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 _LIBCUDACXX_STD_VER > 11 |
|
|
| namespace __detail { |
|
|
| |
|
|
| template <class _Tp, size_t _Disambiguator = 0, class _Enable = void> |
| struct __no_unique_address_emulation { |
| using __stored_type = _Tp; |
| _Tp __v; |
| __MDSPAN_FORCE_INLINE_FUNCTION constexpr _Tp const &__ref() const noexcept { |
| return __v; |
| } |
| __MDSPAN_FORCE_INLINE_FUNCTION constexpr _Tp &__ref() noexcept { |
| return __v; |
| } |
| }; |
|
|
| |
| |
| |
| template <class _Tp, size_t _Disambiguator> |
| struct __no_unique_address_emulation< |
| _Tp, _Disambiguator, |
| _CUDA_VSTD::enable_if_t<_LIBCUDACXX_TRAIT(_CUDA_VSTD::is_empty, _Tp) && |
| |
| |
| |
| _LIBCUDACXX_TRAIT(_CUDA_VSTD::is_trivially_destructible, _Tp)>> : |
| #ifdef __MDSPAN_COMPILER_MSVC |
| |
| |
| protected |
| #else |
| |
| |
| |
| |
| private |
| #endif |
| _Tp { |
| using __stored_type = _Tp; |
| __MDSPAN_FORCE_INLINE_FUNCTION constexpr _Tp const &__ref() const noexcept { |
| return *static_cast<_Tp const *>(this); |
| } |
| __MDSPAN_FORCE_INLINE_FUNCTION constexpr _Tp &__ref() noexcept { |
| return *static_cast<_Tp *>(this); |
| } |
|
|
| __MDSPAN_INLINE_FUNCTION_DEFAULTED |
| constexpr __no_unique_address_emulation() noexcept = default; |
| __MDSPAN_INLINE_FUNCTION_DEFAULTED |
| constexpr __no_unique_address_emulation( |
| __no_unique_address_emulation const &) noexcept = default; |
| __MDSPAN_INLINE_FUNCTION_DEFAULTED |
| constexpr __no_unique_address_emulation( |
| __no_unique_address_emulation &&) noexcept = default; |
| __MDSPAN_INLINE_FUNCTION_DEFAULTED |
| __MDSPAN_CONSTEXPR_14_DEFAULTED __no_unique_address_emulation & |
| operator=(__no_unique_address_emulation const &) noexcept = default; |
| __MDSPAN_INLINE_FUNCTION_DEFAULTED |
| __MDSPAN_CONSTEXPR_14_DEFAULTED __no_unique_address_emulation & |
| operator=(__no_unique_address_emulation &&) noexcept = default; |
| __MDSPAN_INLINE_FUNCTION_DEFAULTED |
| ~__no_unique_address_emulation() noexcept = default; |
|
|
| |
| |
| __MDSPAN_INLINE_FUNCTION |
| explicit constexpr __no_unique_address_emulation(_Tp const& __v) noexcept : _Tp(__v) {} |
| __MDSPAN_INLINE_FUNCTION |
| explicit constexpr __no_unique_address_emulation(_Tp&& __v) noexcept : _Tp(_CUDA_VSTD::move(__v)) {} |
| }; |
|
|
| |
|
|
| } |
|
|
| #endif |
|
|
| _LIBCUDACXX_END_NAMESPACE_STD |
|
|
| #endif |
|
|