| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| #ifndef _LIBCUDACXX___MDSPAN_MAYBE_STATIC_VALUE_HPP |
| #define _LIBCUDACXX___MDSPAN_MAYBE_STATIC_VALUE_HPP |
|
|
| #ifndef __cuda_std__ |
| #include <__config> |
| #endif |
|
|
| #include "../__mdspan/dynamic_extent.h" |
| #include "../__mdspan/macros.h" |
| #ifdef _LIBCUDACXX_HAS_NO_ATTRIBUTE_NO_UNIQUE_ADDRESS |
| #include "../__mdspan/no_unique_address.h" |
| #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 |
|
|
| |
| |
| |
| #if !__MDSPAN_PRESERVE_STANDARD_LAYOUT |
|
|
| _LIBCUDACXX_BEGIN_NAMESPACE_STD |
|
|
| #if _LIBCUDACXX_STD_VER > 11 |
|
|
| |
|
|
| namespace __detail { |
|
|
| |
| template <class _dynamic_t, class _static_t, _static_t __v, |
| _static_t __is_dynamic_sentinal = dynamic_extent, |
| size_t __array_entry_index = 0> |
| struct __maybe_static_value { |
| static constexpr _static_t __static_value = __v; |
| __MDSPAN_FORCE_INLINE_FUNCTION constexpr _dynamic_t __value() const noexcept { |
| return static_cast<_dynamic_t>(__v); |
| } |
| template <class _Up> |
| __MDSPAN_FORCE_INLINE_FUNCTION constexpr |
| __mdspan_enable_fold_comma |
| __set_value(_Up&& ) noexcept { |
| |
| return {}; |
| } |
|
|
| |
|
|
| __MDSPAN_INLINE_FUNCTION_DEFAULTED |
| constexpr __maybe_static_value() noexcept = default; |
| __MDSPAN_INLINE_FUNCTION_DEFAULTED |
| constexpr __maybe_static_value(__maybe_static_value const&) noexcept = default; |
| __MDSPAN_INLINE_FUNCTION_DEFAULTED |
| constexpr __maybe_static_value(__maybe_static_value&&) noexcept = default; |
| __MDSPAN_INLINE_FUNCTION_DEFAULTED |
| __MDSPAN_CONSTEXPR_14_DEFAULTED __maybe_static_value& operator=(__maybe_static_value const&) noexcept = default; |
| __MDSPAN_INLINE_FUNCTION_DEFAULTED |
| __MDSPAN_CONSTEXPR_14_DEFAULTED __maybe_static_value& operator=(__maybe_static_value&&) noexcept = default; |
| __MDSPAN_INLINE_FUNCTION_DEFAULTED |
| ~__maybe_static_value() noexcept = default; |
|
|
| __MDSPAN_INLINE_FUNCTION |
| constexpr explicit __maybe_static_value(_dynamic_t const&) noexcept { |
| |
| } |
|
|
| |
|
|
| }; |
|
|
| |
| template <class _dynamic_t, class _static_t, _static_t __is_dynamic_sentinal, size_t __array_entry_index> |
| struct __maybe_static_value<_dynamic_t, _static_t, __is_dynamic_sentinal, __is_dynamic_sentinal, |
| __array_entry_index> |
| #ifdef _LIBCUDACXX_HAS_NO_ATTRIBUTE_NO_UNIQUE_ADDRESS |
| : __no_unique_address_emulation<_Tp> |
| #endif |
| { |
| static constexpr _static_t __static_value = __is_dynamic_sentinal; |
| #ifndef _LIBCUDACXX_HAS_NO_ATTRIBUTE_NO_UNIQUE_ADDRESS |
| _LIBCUDACXX_NO_UNIQUE_ADDRESS _dynamic_t __v = {}; |
| __MDSPAN_FORCE_INLINE_FUNCTION constexpr _dynamic_t __value() const noexcept { |
| return __v; |
| } |
| __MDSPAN_FORCE_INLINE_FUNCTION constexpr _dynamic_t &__ref() noexcept { |
| return __v; |
| } |
| template <class _Up> |
| __MDSPAN_FORCE_INLINE_FUNCTION constexpr |
| __mdspan_enable_fold_comma |
| __set_value(_Up&& __rhs) noexcept { |
| __v = (_Up &&)rhs; |
| return {}; |
| } |
| #else |
| __MDSPAN_FORCE_INLINE_FUNCTION constexpr _dynamic_t __value() const noexcept { |
| return this->__no_unique_address_emulation<_dynamic_t>::__ref(); |
| } |
| __MDSPAN_FORCE_INLINE_FUNCTION constexpr _dynamic_t &__ref() noexcept { |
| return this->__no_unique_address_emulation<_dynamic_t>::__ref(); |
| } |
| template <class _Up> |
| __MDSPAN_FORCE_INLINE_FUNCTION constexpr |
| __mdspan_enable_fold_comma |
| __set_value(_Up&& __rhs) noexcept { |
| this->__no_unique_address_emulation<_dynamic_t>::__ref() = (_Up &&)__rhs; |
| return {}; |
| } |
| #endif |
| }; |
|
|
| } |
|
|
| |
|
|
|
|
| #endif |
|
|
| _LIBCUDACXX_END_NAMESPACE_STD |
|
|
| #endif |
|
|
| #endif |
|
|