Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions stl/inc/mdspan
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ struct _Mdspan_extent_type<_IndexType, 0> {
}
};

_EXPORT_STD

@JMazurkiewicz Jakub Mazurkiewicz (JMazurkiewicz) Mar 13, 2023

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add test in tests/std/include/test_header_units_and_modules.hpp for this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, once I learn how to use <mdspan> in a basic way 😹 Added to my todo list if nobody else gets to it first, thanks.

template <class _IndexType, size_t... _Extents>
class extents : private _Mdspan_extent_type<_IndexType, ((_Extents == dynamic_extent) + ... + 0), _Extents...> {
public:
Expand Down Expand Up @@ -186,14 +187,14 @@ public:
&& is_nothrow_constructible_v<index_type, const _OtherIndexType&>
&& (_Size == rank_dynamic() || _Size == rank())
constexpr explicit(_Size != rank_dynamic()) extents(span<_OtherIndexType, _Size> _Exts) noexcept
: _Mybase{_Exts, _STD make_index_sequence<rank_dynamic()>{}} {}
: _Mybase{_Exts, make_index_sequence<rank_dynamic()>{}} {}

template <class _OtherIndexType, size_t _Size>
requires is_convertible_v<const _OtherIndexType&, index_type>
&& is_nothrow_constructible_v<index_type, const _OtherIndexType&>
&& (_Size == rank_dynamic() || _Size == rank())
constexpr explicit(_Size != rank_dynamic()) extents(const array<_OtherIndexType, _Size>& _Exts) noexcept
: _Mybase{span{_Exts}, _STD make_index_sequence<rank_dynamic()>{}} {}
: _Mybase{span{_Exts}, make_index_sequence<rank_dynamic()>{}} {}

template <class _OtherIndexType, size_t... _OtherExtents>
_NODISCARD_FRIEND constexpr bool operator==(
Expand Down Expand Up @@ -231,6 +232,7 @@ public:
}
};

_EXPORT_STD
template <class _IndexType, size_t _Rank>
using dextents =
decltype([]<class _IndexType2, size_t... _Seq>(const _IndexType2, const index_sequence<_Seq...>) constexpr {
Expand Down Expand Up @@ -267,16 +269,19 @@ template <class _Layout, class _Mapping>
inline constexpr bool _Is_mapping_of =
is_same_v<typename _Layout::template mapping<typename _Mapping::extents_type>, _Mapping>;

_EXPORT_STD
struct layout_left {
template <class _Extents>
class mapping;
};

_EXPORT_STD
struct layout_right {
template <class _Extents>
class mapping;
};

_EXPORT_STD
struct layout_stride {
template <class _Extents>
class mapping;
Expand Down Expand Up @@ -494,10 +499,6 @@ public:
private:
_Extents _Myext{};

static constexpr size_t _Multiply(size_t _X, size_t _Y) {
return _X * _Y;
}

template <class... _IndexType, size_t... _Seq>
constexpr index_type _Index_impl(_IndexType... _Idx, index_sequence<_Seq...>) const noexcept {
index_type _Result = 0;
Expand Down Expand Up @@ -685,6 +686,7 @@ private:
}
};

_EXPORT_STD
template <class _ElementType>
struct default_accessor {
using offset_policy = default_accessor;
Expand All @@ -709,6 +711,7 @@ struct default_accessor {
}
};

_EXPORT_STD
template <class _ElementType, class _Extents, class _LayoutPolicy = layout_right,
class _AccessorPolicy = default_accessor<_ElementType>>
class mdspan {
Expand Down