19 #include "trait_backports.hpp" 21 #if !defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) 22 # include "no_unique_address.hpp" 26 namespace experimental {
32 _MDSPAN_NO_UNIQUE_ADDRESS _T __t_val;
33 _MDSPAN_NO_UNIQUE_ADDRESS _U __u_val;
34 MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _T &__first() noexcept {
return __t_val; }
35 MDSPAN_FORCE_INLINE_FUNCTION constexpr _T
const &__first()
const noexcept {
38 MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _U &__second() noexcept {
return __u_val; }
39 MDSPAN_FORCE_INLINE_FUNCTION constexpr _U
const &__second()
const noexcept {
43 MDSPAN_INLINE_FUNCTION_DEFAULTED
45 MDSPAN_INLINE_FUNCTION_DEFAULTED
47 MDSPAN_INLINE_FUNCTION_DEFAULTED
49 MDSPAN_INLINE_FUNCTION_DEFAULTED
52 MDSPAN_INLINE_FUNCTION_DEFAULTED
55 MDSPAN_INLINE_FUNCTION_DEFAULTED
57 template <
class _TLike,
class _ULike>
59 : __t_val((_TLike &&) __t), __u_val((_ULike &&) __u) {}
62 #if !defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) 65 template <
class _T,
class _U>
68 enable_if_t<_MDSPAN_TRAIT(is_empty, _T) && !_MDSPAN_TRAIT(is_empty, _U)>>
71 MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _T &__first() noexcept {
72 return *
static_cast<_T *
>(
this);
74 MDSPAN_FORCE_INLINE_FUNCTION constexpr _T
const &__first()
const noexcept {
75 return *
static_cast<_T
const *
>(
this);
77 MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _U &__second() noexcept {
return __u_val; }
78 MDSPAN_FORCE_INLINE_FUNCTION constexpr _U
const &__second()
const noexcept {
82 MDSPAN_INLINE_FUNCTION_DEFAULTED
84 MDSPAN_INLINE_FUNCTION_DEFAULTED
86 MDSPAN_INLINE_FUNCTION_DEFAULTED
88 MDSPAN_INLINE_FUNCTION_DEFAULTED
91 MDSPAN_INLINE_FUNCTION_DEFAULTED
94 MDSPAN_INLINE_FUNCTION_DEFAULTED
96 template <
class _TLike,
class _ULike>
98 : _T((_TLike &&) __t), __u_val((_ULike &&) __u) {}
102 template <
class _T,
class _U>
105 enable_if_t<!_MDSPAN_TRAIT(is_empty, _T) && _MDSPAN_TRAIT(is_empty, _U)>>
108 MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _T &__first() noexcept {
return __t_val; }
109 MDSPAN_FORCE_INLINE_FUNCTION constexpr _T
const &__first()
const noexcept {
112 MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _U &__second() noexcept {
113 return *
static_cast<_U *
>(
this);
115 MDSPAN_FORCE_INLINE_FUNCTION constexpr _U
const &__second()
const noexcept {
116 return *
static_cast<_U
const *
>(
this);
119 MDSPAN_INLINE_FUNCTION_DEFAULTED
121 MDSPAN_INLINE_FUNCTION_DEFAULTED
123 MDSPAN_INLINE_FUNCTION_DEFAULTED
125 MDSPAN_INLINE_FUNCTION_DEFAULTED
128 MDSPAN_INLINE_FUNCTION_DEFAULTED
131 MDSPAN_INLINE_FUNCTION_DEFAULTED
134 template <
class _TLike,
class _ULike>
136 : _U((_ULike &&) __u), __t_val((_TLike &&) __t) {}
140 template <
class _T,
class _U>
143 enable_if_t<_MDSPAN_TRAIT(is_empty, _T) && _MDSPAN_TRAIT(is_empty, _U)>>
146 #ifdef _MDSPAN_COMPILER_MSVC 159 MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _T &__first() noexcept {
160 return this->__first_base_t::__ref();
162 MDSPAN_FORCE_INLINE_FUNCTION constexpr _T
const &__first()
const noexcept {
163 return this->__first_base_t::__ref();
165 MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _U &__second() noexcept {
166 return this->__second_base_t::__ref();
168 MDSPAN_FORCE_INLINE_FUNCTION constexpr _U
const &__second()
const noexcept {
169 return this->__second_base_t::__ref();
172 MDSPAN_INLINE_FUNCTION_DEFAULTED
174 MDSPAN_INLINE_FUNCTION_DEFAULTED
176 MDSPAN_INLINE_FUNCTION_DEFAULTED
178 MDSPAN_INLINE_FUNCTION_DEFAULTED
181 MDSPAN_INLINE_FUNCTION_DEFAULTED
184 MDSPAN_INLINE_FUNCTION_DEFAULTED
186 template <
class _TLike,
class _ULike>
187 MDSPAN_INLINE_FUNCTION constexpr
__compressed_pair(_TLike &&__t, _ULike &&__u) noexcept
193 #endif // !defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) Definition: compressed_pair.hpp:31