initializer_list{_S_storage::_S_int_cast(__exts)...}))
{ }
- template<__mdspan::__valid_index_type<index_type> _OIndexType, size_t _Nm>
- requires (_Nm == rank() || _Nm == rank_dynamic())
+ template<typename _OIndexType, size_t _Nm>
+ requires __mdspan::__valid_index_type<const _OIndexType&, index_type>
+ && (_Nm == rank() || _Nm == rank_dynamic())
constexpr explicit(_Nm != rank_dynamic())
extents(span<_OIndexType, _Nm> __exts) noexcept
: _M_exts(span<const _OIndexType, _Nm>(__exts))
{ }
- template<__mdspan::__valid_index_type<index_type> _OIndexType, size_t _Nm>
- requires (_Nm == rank() || _Nm == rank_dynamic())
+ template<typename _OIndexType, size_t _Nm>
+ requires __mdspan::__valid_index_type<const _OIndexType&, index_type>
+ && (_Nm == rank() || _Nm == rank_dynamic())
constexpr explicit(_Nm != rank_dynamic())
extents(const array<_OIndexType, _Nm>& __exts) noexcept
: _M_exts(span<const _OIndexType, _Nm>(__exts))
constexpr
mapping(const mapping&) noexcept = default;
- template<__mdspan::__valid_index_type<index_type> _OIndexType>
+ template<typename _OIndexType>
+ requires __mdspan::__valid_index_type<const _OIndexType&, index_type>
constexpr
mapping(const extents_type& __exts,
span<_OIndexType, extents_type::rank()> __strides) noexcept
_M_strides[__i] = index_type(as_const(__strides[__i]));
}
- template<__mdspan::__valid_index_type<index_type> _OIndexType>
+ template<typename _OIndexType>
+ requires __mdspan::__valid_index_type<const _OIndexType&, index_type>
constexpr
mapping(const extents_type& __exts,
const array<_OIndexType, extents_type::rank()>& __strides)
_M_handle(std::move(__handle))
{ }
- template<__mdspan::__valid_index_type<index_type> _OIndexType,
- size_t _Nm>
- requires (_Nm == rank() || _Nm == rank_dynamic())
+ template<typename _OIndexType, size_t _Nm>
+ requires __mdspan::__valid_index_type<const _OIndexType&, index_type>
+ && (_Nm == rank() || _Nm == rank_dynamic())
&& is_constructible_v<mapping_type, extents_type>
&& is_default_constructible_v<accessor_type>
constexpr explicit(_Nm != rank_dynamic())
_M_handle(std::move(__handle))
{ }
- template<__mdspan::__valid_index_type<index_type> _OIndexType,
- size_t _Nm>
- requires (_Nm == rank() || _Nm == rank_dynamic())
+ template<typename _OIndexType, size_t _Nm>
+ requires __mdspan::__valid_index_type<const _OIndexType&, index_type>
+ && (_Nm == rank() || _Nm == rank_dynamic())
&& is_constructible_v<mapping_type, extents_type>
&& is_default_constructible_v<accessor_type>
constexpr explicit(_Nm != rank_dynamic())
return _M_accessor.access(_M_handle, __index);
}
- template<__mdspan::__valid_index_type<index_type> _OIndexType>
+ template<typename _OIndexType>
+ requires __mdspan::__valid_index_type<const _OIndexType&, index_type>
constexpr reference
operator[](span<_OIndexType, rank()> __indices) const
{
return __call(make_index_sequence<rank()>());
}
- template<__mdspan::__valid_index_type<index_type> _OIndexType>
+ template<typename _OIndexType>
+ requires __mdspan::__valid_index_type<const _OIndexType&, index_type>
constexpr reference
operator[](const array<_OIndexType, rank()>& __indices) const
{ return (*this)[span<const _OIndexType, rank()>(__indices)]; }
static_assert(has_linear_index<Mapping, int>);
static_assert(has_linear_index<Mapping, double>);
static_assert(has_linear_index<Mapping, IntLike>);
+ static_assert(has_linear_index<Mapping, MutatingInt>);
static_assert(!has_linear_index<Mapping, ThrowingInt>);
static_assert(!has_linear_index<Mapping, NotIntLike>);
static_assert(!has_linear_index<Mapping, int, int>);
static_assert(has_linear_index<Mapping, int, int>);
static_assert(has_linear_index<Mapping, double, double>);
static_assert(has_linear_index<Mapping, IntLike, int>);
+ static_assert(has_linear_index<Mapping, MutatingInt, int>);
static_assert(!has_linear_index<Mapping, ThrowingInt, int>);
static_assert(!has_linear_index<Mapping, NotIntLike, int>);
static_assert(!has_linear_index<Mapping, int, int, int>);
if !consteval
{
test_linear_index_all<Layout, IntLike>();
+ test_linear_index_all<Layout, MutatingInt>();
}
test_required_span_size_all<Layout>();
test_stride_constructible<E0, E0, int, 0, true>();
test_stride_constructible<E0, E0, IntLike, 0, true>();
test_stride_constructible<E0, E0, ThrowingInt, 0, false>();
+ test_stride_constructible<E0, E0, MutatingInt, 0, false>();
test_stride_constructible<E0, E0, NotIntLike, 0, false>();
test_stride_constructible<E1, E1, int, 1, true>();
test_stride_constructible<E2, E1, int, 1, true>();
static_assert(test_from_int_like<int, true, true>());
test_from_int_like<IntLike, true, true>();
test_from_int_like<ThrowingInt, false, false>();
+ test_from_int_like<MutatingInt, true, false>();
test_from_opaque_accessor();
test_from_base_class_accessor();
static_assert(test_access<int, true, true>());
test_access<IntLike, true, true>();
test_access<ThrowingInt, false, false>();
+ test_access<MutatingInt, true, false>();
test_swap();
static_assert(test_swap());