27 #ifndef FUB_CORE_MDSPAN_HPP 
   28 #define FUB_CORE_MDSPAN_HPP 
   36 #include <type_traits> 
   38 #include <boost/mp11/tuple.hpp> 
   45 template <std::size_t Rank, std::size_t DynamicRank,
 
   46           std::ptrdiff_t... StaticExtents>
 
   47 class ExtentsStorage_;
 
   53 template <std::size_t Rank, std::ptrdiff_t... StaticExtents>
 
   56   static_assert(Rank == 
sizeof...(StaticExtents),
 
   57                 "Rank does not match sizeof...(StaticExtents)!");
 
   60       "Some static extent is equal to dynamic_extent!");
 
   65   static constexpr std::size_t 
rank() noexcept { 
return Rank; }
 
   72     const std::ptrdiff_t static_extents[Rank]{StaticExtents...};
 
   73     return static_extents[n];
 
   80   constexpr std::ptrdiff_t 
extent(
size_t n) 
const noexcept {
 
   85 template <std::size_t Rank, std::ptrdiff_t... StaticExtents>
 
   88   static_assert(Rank == 
sizeof...(StaticExtents),
 
   89                 "Rank does not match sizeof...(StaticExtents)!");
 
   92       "Not all static extents are equal to dynamic_extent!");
 
   98   template <
typename... IndexType,
 
  100                 std::is_convertible<IndexType, std::ptrdiff_t>...>::value>,
 
  101             typename = std::enable_if_t<
sizeof...(IndexType) == Rank>>
 
  106       const std::array<std::ptrdiff_t, Rank>& 
extents) noexcept
 
  112   static constexpr std::size_t 
rank() noexcept { 
return Rank; }
 
  123   constexpr std::ptrdiff_t 
extent(
size_t n) 
const noexcept {
 
  131 template <std::size_t Rank, std::size_t RankDynamic,
 
  132           std::ptrdiff_t... StaticExtents>
 
  139   template <
typename... IndexType,
 
  141                 std::is_convertible<IndexType, std::ptrdiff_t>...>::value>,
 
  142             typename = std::enable_if_t<
sizeof...(IndexType) == RankDynamic>>
 
  147       const std::array<std::ptrdiff_t, RankDynamic>& 
extents) noexcept
 
  153   static constexpr std::size_t 
rank() noexcept { 
return Rank; }
 
  156   static constexpr std::size_t 
rank_dynamic() noexcept { 
return RankDynamic; }
 
  160     constexpr std::ptrdiff_t static_extents[Rank]{StaticExtents...};
 
  161     return static_extents[n];
 
  165   constexpr std::ptrdiff_t 
extent(
size_t n) 
const noexcept {
 
  166     constexpr std::ptrdiff_t static_extents[Rank]{StaticExtents...};
 
  168       return static_extents[n];
 
  176   static constexpr std::size_t
 
  178     constexpr std::ptrdiff_t static_extents[Rank]{StaticExtents...};
 
  179     std::size_t dynamic_extent_index = 0;
 
  180     for (std::size_t dim = 0; dim < n; ++dim) {
 
  182         ++dynamic_extent_index;
 
  185     return dynamic_extent_index;
 
  189 template <
typename... IndexType>
 
  191   constexpr std::size_t Rank = 
sizeof...(IndexType);
 
  192   std::ptrdiff_t 
extents[Rank]{
static_cast<std::ptrdiff_t
>(extent)...};
 
  193   std::size_t counter = 0;
 
  194   for (std::size_t dim = 0; dim < Rank; ++dim) {
 
  205 template <std::ptrdiff_t... StaticExtents>
 
  207                                         count_dynamic_extents(StaticExtents...),
 
  221   using base_type::base_type;
 
  241   constexpr std::ptrdiff_t 
extent(
size_t n) 
const noexcept {
 
  252 template <
typename E> 
struct is_extents : std::false_type {};
 
  253 template <std::ptrdiff_t... StaticExtents>
 
  261 template <std::ptrdiff_t... StaticExtentsL, std::ptrdiff_t... StaticExtentsR>
 
  264   if (lhs.rank() != rhs.rank()) {
 
  267   for (std::size_t r = 0; r < lhs.rank(); ++r) {
 
  268     if (lhs.extent(r) != rhs.extent(r)) {
 
  275 template <std::ptrdiff_t... StaticExtentsL, std::ptrdiff_t... StaticExtentsR>
 
  278   return !(left == right);
 
  281 template <std::ptrdiff_t... StaticExtents>
 
  283   const std::size_t rank = e.rank();
 
  284   std::ptrdiff_t size = 1;
 
  285   for (std::size_t r = 0; r < rank; ++r) {
 
  304     static_assert(is_extents_v<Extents>,
 
  305                   "Extents must satisfy the extents concept.");
 
  343         typename... IndexType,
 
  345             std::is_convertible<IndexType, std::ptrdiff_t>...>::value>,
 
  346         typename = std::enable_if_t<(
sizeof...(IndexType) == Extents::rank())>>
 
  347     constexpr std::ptrdiff_t 
operator()(IndexType... indices) 
const noexcept {
 
  354     constexpr std::ptrdiff_t 
stride(std::size_t r) 
const noexcept {
 
  355       std::ptrdiff_t 
stride = 1;
 
  356       for (std::size_t dim = 0; dim < r; ++dim) {
 
  366     constexpr 
bool is_unique() const noexcept { 
return true; }
 
  370     template <
class OtherExtents>
 
  373       return extents() == other.extents();
 
  376     template <
class OtherExtents>
 
  379       return !(*
this == other);
 
  384     template <std::size_t... Is, 
typename... IndexType>
 
  386                                         IndexType... indices) 
const noexcept {
 
  387       const std::ptrdiff_t is[Extents::rank()]{
 
  388           static_cast<std::ptrdiff_t
>(indices)...};
 
  389       const std::ptrdiff_t strides[Extents::rank()]{
stride(Is)...};
 
  390       std::ptrdiff_t 
index = 0;
 
  391       for (std::size_t r = 0; r < Extents::rank(); ++r) {
 
  392         index += strides[r] * is[r];
 
  419         typename... IndexType,
 
  421             std::is_convertible<IndexType, std::ptrdiff_t>...>::value>,
 
  422         typename = std::enable_if_t<(
sizeof...(IndexType) == Extents::rank())>>
 
  423     constexpr std::ptrdiff_t 
operator()(IndexType... indices) 
const noexcept {
 
  427     constexpr std::ptrdiff_t 
stride(std::size_t r) 
const noexcept {
 
  428       std::ptrdiff_t 
stride = 1;
 
  429       for (std::size_t dim = r + 1; dim < Extents::rank(); ++dim) {
 
  439     constexpr 
bool is_unique() const noexcept { 
return true; }
 
  443     template <
class OtherExtents>
 
  446       return extents() == other.extents();
 
  449     template <
class OtherExtents>
 
  452       return !(*
this == other);
 
  456     template <std::size_t... Is, 
typename... IndexType>
 
  458                                         IndexType... indices) 
const noexcept {
 
  459       const std::ptrdiff_t is[Extents::rank()]{
 
  460           static_cast<std::ptrdiff_t
>(indices)...};
 
  461       const std::ptrdiff_t strides[Extents::rank()]{
stride(Is)...};
 
  462       std::ptrdiff_t 
index = 0;
 
  463       for (std::size_t r = 0; r < Extents::rank(); ++r) {
 
  464         index += strides[r] * is[r];
 
  480         const std::array<std::ptrdiff_t, Extents::rank()>& s) noexcept
 
  483     std::array<std::ptrdiff_t, Extents::rank()>
 
  485       std::array<std::ptrdiff_t, Extents::rank()> 
strides;
 
  486       for (std::size_t s = 0; s < Extents::rank(); ++s) {
 
  498     constexpr 
const std::array<std::ptrdiff_t, Extents::rank()>& 
strides() const
 
  505       for (std::size_t r = 1; r < Extents::rank(); ++r) {
 
  512         typename... IndexType,
 
  514             std::is_convertible<IndexType, std::ptrdiff_t>...>::value>,
 
  515         typename = std::enable_if_t<(
sizeof...(IndexType) == Extents::rank())>>
 
  516     std::ptrdiff_t 
operator()(IndexType... is) 
const {
 
  517       const std::array<std::ptrdiff_t, Extents::rank()> idx{
 
  518           static_cast<std::ptrdiff_t
>(is)...};
 
  519       std::ptrdiff_t offset = 0;
 
  520       for (std::size_t r = 0; r < Extents::rank(); ++r) {
 
  530     constexpr 
bool is_unique() const noexcept { 
return true; }
 
  536     template <
class OtherExtents>
 
  539       return extents() == other.extents();
 
  541     template <
class OtherExtents>
 
  544       return !(*
this == other);
 
  548     std::array<std::ptrdiff_t, Extents::rank()> 
strides_;
 
  571 template <
class ElementType, 
class Extents, 
class LayoutPolicy = layout_right,
 
  572           class AccessorPolicy = accessor_basic<ElementType>>
 
  573 class basic_mdspan : AccessorPolicy, LayoutPolicy::template mapping<Extents> {
 
  579   using mapping_type = 
typename layout_type::template mapping<extents_type>;
 
  584   using pointer = 
typename accessor_type::pointer;
 
  592   template <class... IndexType,
 
  594                 std::is_convertible<IndexType, std::ptrdiff_t>...>::value>,
 
  595             typename = std::enable_if_t<sizeof...(IndexType) ==
 
  600   template <
class IndexType, std::
size_t N>
 
  612   template <
class OtherElementType, 
class OtherExtents, 
class OtherLayoutPolicy,
 
  613             class OtherAccessorPolicy>
 
  615       const basic_mdspan<OtherElementType, OtherExtents, OtherLayoutPolicy,
 
  616                          OtherAccessorPolicy>& other)
 
  624   template <class OtherElementType, class OtherExtents, class OtherLayoutPolicy,
 
  625             class OtherAccessorPolicy>
 
  627       const 
basic_mdspan<OtherElementType, OtherExtents, OtherLayoutPolicy,
 
  628                          OtherAccessorPolicy>& other) noexcept {
 
  640   template <
class... IndexType>
 
  644     return acc.access(
ptr_, map(indices...));
 
  647   template <
class IndexType, 
size_t N>
 
  652     return acc.access(
ptr_, boost::mp11::tuple_apply(map, indices));
 
  658   static constexpr 
int rank() noexcept { 
return Extents::rank(); }
 
  661     return Extents::rank_dynamic();
 
  665     return Extents::static_extent(
rank);
 
  687     return mapping_type::is_always_unique();
 
  690     return mapping_type::is_always_contiguous();
 
  693     return mapping_type::is_always_strided();
 
  700     return mapping().is_contiguous();
 
  713 template <
typename T, ptrdiff_t... 
Extents>
 
  718 template <
typename I, I... Is>
 
  723 template <std::
size_t Rank>
 
  731 template <
typename T, std::
size_t Rank, 
typename Layout = layout_left>
 
  735 template <
typename T, 
typename E, 
typename A = accessor_basic<T>>
 
  744 template <
typename T>
 
  747           std::is_convertible<T, std::pair<std::ptrdiff_t, std::ptrdiff_t>>,
 
  748           std::is_convertible<T, all_type>> {};
 
  750 template <
typename I, 
typename... Is> constexpr I Accumulate_(I x0, Is... xi) {
 
  751   const I x[] = {x0, xi...};
 
  752   constexpr 
int size = 1 + 
static_cast<int>(
sizeof...(Is));
 
  754   for (
int i = 0; i < size; ++i) {
 
  760 template <
typename... SliceSpecifiers>
 
  761 static constexpr std::size_t SliceRank_ =
 
  762     Accumulate_(
static_cast<int>(IsSliceRange_<SliceSpecifiers>::value)...);
 
  766 template <
class ElementType, 
class Extents, 
class LayoutPolicy,
 
  767           class AccessorPolicy, 
class... SliceSpecifiers>
 
  769   static constexpr std::size_t 
slice_rank = SliceRank_<SliceSpecifiers...>;
 
  773                             typename AccessorPolicy::offset_policy>;
 
  776 template <
class ElementType, 
class Extents, 
class LayoutPolicy,
 
  777           class AccessorPolicy, 
class... SliceSpecifiers>
 
  780                             SliceSpecifiers...>::type;
 
  782 constexpr std::ptrdiff_t
 
  786   return p.second - p.first;
 
  792 template <typename T, typename = std::enable_if_t<!IsSliceRange_<T>::value>>
 
  797 template <std::
size_t Rank, 
typename Slice>
 
  798 constexpr std::array<std::ptrdiff_t, Rank + 1>
 
  799 SlicePushBack__(std::true_type, std::array<std::ptrdiff_t, Rank> array,
 
  801   std::array<std::ptrdiff_t, Rank + 1> grown{};
 
  802   for (std::size_t i = 0; i < Rank; ++i) {
 
  809 template <std::
size_t Rank, 
typename Slice>
 
  810 constexpr std::array<std::ptrdiff_t, Rank>
 
  811 SlicePushBack__(std::false_type, std::array<std::ptrdiff_t, Rank> array,
 
  816 template <std::
size_t Rank, 
typename Slice>
 
  817 constexpr 
auto SlicePushBack_(std::array<std::ptrdiff_t, Rank> array,
 
  819   return SlicePushBack__(IsSliceRange_<Slice>(), array, slice);
 
  822 template <std::
size_t Rank>
 
  823 constexpr 
auto MakeSliceExtents__(std::array<std::ptrdiff_t, Rank> result) {
 
  827 template <std::size_t Rank, 
typename Slice, 
typename... Rest>
 
  828 constexpr 
auto MakeSliceExtents__(std::array<std::ptrdiff_t, Rank> prev,
 
  829                                   Slice slice, Rest... slices) {
 
  830   return MakeSliceExtents__(SlicePushBack_(prev, slice), slices...);
 
  833 template <
typename... Slices>
 
  834 constexpr 
auto MakeSliceExtents_(Slices... slices) {
 
  835   return MakeSliceExtents__(std::array<std::ptrdiff_t, 0>{}, slices...);
 
  838 template <
class ElementType, 
class Extents, 
class LayoutPolicy,
 
  839           class AccessorPolicy, std::size_t... Is>
 
  840 constexpr std::array<std::ptrdiff_t, 
sizeof...(Is)> MakeStrideArray_(
 
  841     const basic_mdspan<ElementType, Extents, LayoutPolicy, AccessorPolicy>& src,
 
  842     index_sequence<Is...>) {
 
  843   return {src.stride(Is)...};
 
  846 template <
typename T> 
struct Type_ {};
 
  848 template <std::size_t N, std::size_t... Is>
 
  849 constexpr std::array<std::size_t, N> AsStdArray__(
const std::size_t (&array)[N],
 
  850                                                   index_sequence<Is...>) {
 
  851   return {array[Is]...};
 
  854 template <std::
size_t N>
 
  855 constexpr std::array<std::size_t, N>
 
  856 AsStdArray_(
const std::size_t (&array)[N]) {
 
  857   return AsStdArray__(array, make_index_sequence<N>());
 
  860 template <
typename... Slices>
 
  861 constexpr std::array<std::size_t, SliceRank_<Slices...>>
 
  862 MakeRangeIndices__(Type_<Slices>... ) {
 
  863   constexpr std::size_t is_range[] = {IsSliceRange_<Slices>::value...};
 
  864   std::size_t ranges[SliceRank_<Slices...>]{};
 
  866   for (std::size_t i = 0; i < 
sizeof...(Slices); ++i) {
 
  871   return AsStdArray_(ranges);
 
  874 template <
typename... Slices, std::size_t... Is>
 
  875 constexpr 
auto MakeRangeIndices_(index_sequence<Is...>,
 
  877   constexpr std::array<std::size_t, SliceRank_<Slices...>> indices{
 
  878       MakeRangeIndices__(Type_<Slices>{}...)};
 
  882 template <
typename... Slices>
 
  883 constexpr 
auto MakeRangeIndices_(Type_<Slices>... slices) {
 
  888 template <
typename... Slices> constexpr 
auto MakeRangeIndices(Slices...) {
 
  889   return MakeRangeIndices_(Type_<Slices>{}...);
 
  892 template <
class ElementType, 
class Extents, 
class LayoutPolicy,
 
  893           class AccessorPolicy, 
typename... Slices>
 
  894 constexpr 
auto MakeSliceArray_(
 
  895     const basic_mdspan<ElementType, Extents, LayoutPolicy, AccessorPolicy>& src,
 
  897   constexpr 
auto range_indices = MakeRangeIndices_(Type_<Slices>{}...);
 
  898   return MakeStrideArray_(src, range_indices);
 
  901 constexpr std::ptrdiff_t MakeOrigin__(std::ptrdiff_t n) { 
return n; }
 
  903 constexpr std::ptrdiff_t
 
  904 MakeOrigin__(std::pair<std::ptrdiff_t, std::ptrdiff_t> p) {
 
  908 constexpr std::ptrdiff_t MakeOrigin__(all_type ) { 
return 0; }
 
  910 template <
typename... Slices>
 
  911 constexpr std::array<std::ptrdiff_t, 
sizeof...(Slices)>
 
  912 MakeOrigin_(Slices... slices) {
 
  913   return {MakeOrigin__(slices)...};
 
  916 template <std::size_t... Is, 
typename F, std::size_t N>
 
  917 constexpr 
auto Apply_(index_sequence<Is...>, F fn,
 
  918                       std::array<std::ptrdiff_t, N> indices) {
 
  919   return fn(indices[Is]...);
 
  922 template <
typename F, std::
size_t N>
 
  923 constexpr 
auto Apply_(F fn, std::array<std::ptrdiff_t, N> indices) {
 
  924   return Apply_(make_index_sequence<N>{}, fn, indices);
 
  927 constexpr std::ptrdiff_t MapToLength_(all_type) { 
return -1; }
 
  929 constexpr std::ptrdiff_t
 
  930 MapToLength_(
const std::pair<std::ptrdiff_t, std::ptrdiff_t>& rng) {
 
  931   return rng.second - rng.first;
 
  934 template <typename T, typename = std::enable_if_t<!IsSliceRange_<T>()>>
 
  935 constexpr std::ptrdiff_t MapToLength_(T) {
 
  939 template <
typename Extents, 
typename... SliceSpecifiers>
 
  940 constexpr std::array<std::ptrdiff_t, SliceRank_<SliceSpecifiers...>>
 
  941 MakeSliceExtents2_(
const Extents& e, SliceSpecifiers... slices) {
 
  942   const std::array<std::ptrdiff_t, Extents::rank()> length{
 
  943       MapToLength_(slices)...};
 
  944   std::array<std::ptrdiff_t, Extents::rank()> dyn_length{};
 
  945   for (std::size_t i = 0; i < Extents::rank(); ++i) {
 
  947       dyn_length[i] = e.extent(i);
 
  949       dyn_length[i] = length[i];
 
  952   std::array<std::ptrdiff_t, SliceRank_<SliceSpecifiers...>> extents{};
 
  953   std::size_t slice = 0;
 
  954   for (std::size_t i = 0; i < Extents::rank(); ++i) {
 
  955     if (dyn_length[i] > 0) {
 
  956       extents[slice] = dyn_length[i];
 
  964 template <
class ElementType, 
class Extents, 
class LayoutPolicy,
 
  965           class AccessorPolicy, 
class... SliceSpecifiers>
 
  970     SliceSpecifiers... slices) noexcept {
 
  971   const std::array<std::ptrdiff_t, Extents::rank()> origin =
 
  972       MakeOrigin_(slices...);
 
  973   const auto map = src.mapping();
 
  974   const auto acc = src.accessor();
 
  975   constexpr std::size_t slice_rank = SliceRank_<SliceSpecifiers...>;
 
  977   const SliceExtents 
extents{MakeSliceExtents2_(src.extents(), slices...)};
 
  978   const std::array<std::ptrdiff_t, slice_rank> slice_array =
 
  979       MakeSliceArray_(src, slices...);
 
  982   return {acc.offset(src.data(), Apply_(map, origin)), slice_mapping};
 
  985 template <
typename> 
struct is_mdspan : std::false_type {};
 
  987 template <
typename T, 
typename E, 
typename L, 
typename A>
 
#define FUB_ASSERT(x)
Definition: assert.hpp:39
 
static constexpr std::size_t rank() noexcept
Returns sizeof...(StaticExtents)
Definition: mdspan.hpp:65
 
static constexpr std::size_t rank_dynamic() noexcept
Returns 0.
Definition: mdspan.hpp:68
 
static constexpr std::ptrdiff_t static_extent(std::size_t n) noexcept
Returns the n-th Static Extent.
Definition: mdspan.hpp:71
 
constexpr std::ptrdiff_t extent(size_t n) const noexcept
Returns the N-th Extent.
Definition: mdspan.hpp:80
 
constexpr ExtentsStorage_(const std::array< std::ptrdiff_t, Rank > &extents) noexcept
Definition: mdspan.hpp:105
 
constexpr std::ptrdiff_t extent(size_t n) const noexcept
Returns the N-th Extent.
Definition: mdspan.hpp:123
 
static constexpr std::size_t rank() noexcept
Returns sizeof...(StaticExtents)
Definition: mdspan.hpp:112
 
static constexpr std::size_t rank_dynamic() noexcept
Returns sizeof...(StaticExtents)
Definition: mdspan.hpp:115
 
constexpr ExtentsStorage_(IndexType... extent) noexcept
Definition: mdspan.hpp:102
 
ExtentsStorage_()=default
 
static constexpr std::ptrdiff_t static_extent(std::size_t) noexcept
Returns dynamic_extent.
Definition: mdspan.hpp:118
 
This is the storage type for the extents class and only takes storage for dynamic extents.
Definition: mdspan.hpp:133
 
std::array< std::ptrdiff_t, RankDynamic > m_dynamic_extents
Definition: mdspan.hpp:174
 
static constexpr std::ptrdiff_t static_extent(std::size_t n) noexcept
Returns dynamic_extent.
Definition: mdspan.hpp:159
 
constexpr std::ptrdiff_t extent(size_t n) const noexcept
Returns the N-th Extent.
Definition: mdspan.hpp:165
 
static constexpr std::size_t rank_dynamic() noexcept
Returns sizeof...(StaticExtents)
Definition: mdspan.hpp:156
 
static constexpr std::size_t find_dynamic_extent_index(std::size_t n) noexcept
Definition: mdspan.hpp:177
 
static constexpr std::size_t rank() noexcept
Returns sizeof...(StaticExtents)
Definition: mdspan.hpp:153
 
ExtentsStorage_()=default
 
constexpr ExtentsStorage_(const std::array< std::ptrdiff_t, RankDynamic > &extents) noexcept
Definition: mdspan.hpp:146
 
constexpr ExtentsStorage_(IndexType... extent) noexcept
Definition: mdspan.hpp:143
 
Definition: mdspan.hpp:573
 
static constexpr int rank() noexcept
Definition: mdspan.hpp:658
 
constexpr Extents extents() const noexcept
Definition: mdspan.hpp:668
 
constexpr index_type stride(std::size_t r) const
Definition: mdspan.hpp:704
 
static constexpr bool is_always_strided() noexcept
Definition: mdspan.hpp:692
 
std::ptrdiff_t difference_type
Definition: mdspan.hpp:583
 
constexpr bool is_contiguous() const noexcept
Definition: mdspan.hpp:699
 
constexpr basic_mdspan(pointer p, const std::array< IndexType, N > &dynamic_extents)
Definition: mdspan.hpp:601
 
constexpr reference operator[](index_type i) const noexcept
Definition: mdspan.hpp:636
 
constexpr basic_mdspan() noexcept=default
 
constexpr basic_mdspan & operator=(basic_mdspan &&) noexcept=default
 
std::ptrdiff_t index_type
Definition: mdspan.hpp:582
 
pointer ptr_
Definition: mdspan.hpp:709
 
constexpr basic_mdspan(pointer p, const mapping_type &m)
Definition: mdspan.hpp:605
 
static constexpr index_type static_extent(std::size_t rank) noexcept
Definition: mdspan.hpp:664
 
constexpr basic_mdspan & operator=(const basic_mdspan &) noexcept=default
 
constexpr accessor_type accessor() const noexcept
Definition: mdspan.hpp:697
 
constexpr index_type extent(std::size_t rank) const noexcept
Definition: mdspan.hpp:670
 
constexpr bool is_strided() const noexcept
Definition: mdspan.hpp:702
 
constexpr basic_mdspan(const basic_mdspan< OtherElementType, OtherExtents, OtherLayoutPolicy, OtherAccessorPolicy > &other)
Definition: mdspan.hpp:614
 
constexpr span< element_type > get_span() const noexcept
Definition: mdspan.hpp:679
 
constexpr bool is_unique() const noexcept
Definition: mdspan.hpp:698
 
LayoutPolicy layout_type
Definition: mdspan.hpp:577
 
constexpr mapping_type mapping() const noexcept
Definition: mdspan.hpp:696
 
constexpr basic_mdspan(pointer p, const mapping_type &m, const accessor_type &a)
Definition: mdspan.hpp:608
 
AccessorPolicy accessor_type
Definition: mdspan.hpp:578
 
Extents extents_type
Definition: mdspan.hpp:576
 
constexpr index_type unique_size() const noexcept
Definition: mdspan.hpp:676
 
constexpr reference operator()(IndexType... indices) const noexcept
Definition: mdspan.hpp:641
 
std::remove_cv_t< element_type > value_type
Definition: mdspan.hpp:581
 
static constexpr bool is_always_unique() noexcept
Definition: mdspan.hpp:686
 
constexpr reference operator()(const std::array< IndexType, N > &indices) const noexcept
Definition: mdspan.hpp:648
 
constexpr pointer data() const noexcept
Definition: mdspan.hpp:683
 
constexpr index_type size() const noexcept
Definition: mdspan.hpp:674
 
typename layout_type::template mapping< extents_type > mapping_type
Definition: mdspan.hpp:579
 
static constexpr bool is_always_contiguous() noexcept
Definition: mdspan.hpp:689
 
static constexpr int rank_dynamic() noexcept
Definition: mdspan.hpp:660
 
An extents object defines a multidimensional index space which is the Cartesian product of integers e...
Definition: mdspan.hpp:208
 
std::ptrdiff_t index_type
Definition: mdspan.hpp:217
 
constexpr std::ptrdiff_t extent(size_t n) const noexcept
Returns the n-th run-time extent.
Definition: mdspan.hpp:241
 
static constexpr std::size_t rank_dynamic() noexcept
Returns sizeof...(StaticExtents)
Definition: mdspan.hpp:229
 
static constexpr std::ptrdiff_t static_extent(std::size_t n) noexcept
Returns the n-th StaticExtent.
Definition: mdspan.hpp:234
 
static constexpr std::size_t rank() noexcept
Returns sizeof...(StaticExtents)
Definition: mdspan.hpp:226
 
This mapping does row first indexing (as in Fortran).
Definition: mdspan.hpp:302
 
constexpr bool is_contiguous() const noexcept
Definition: mdspan.hpp:367
 
constexpr bool operator!=(const mapping< OtherExtents > &other) const noexcept
Definition: mdspan.hpp:377
 
constexpr mapping()=default
Implicit Conversion from Extents.
 
constexpr mapping(const Extents &extents)
Implicit Conversion from Extents.
Definition: mdspan.hpp:320
 
mapping & operator=(const mapping &other) noexcept=default
Implicit Conversion from Extents.
 
constexpr std::ptrdiff_t required_span_size() const noexcept
Definition: mdspan.hpp:327
 
constexpr mapping(const mapping &)=default
Implicit Conversion from Extents.
 
static constexpr bool is_always_contiguous() noexcept
Definition: mdspan.hpp:363
 
constexpr const Extents & extents() const noexcept
Definition: mdspan.hpp:325
 
constexpr bool is_strided() const noexcept
Definition: mdspan.hpp:368
 
mapping & operator=(mapping &&other) noexcept=default
Implicit Conversion from Extents.
 
constexpr bool operator==(const mapping< OtherExtents > &other) const noexcept
Definition: mdspan.hpp:371
 
constexpr bool is_unique() const noexcept
Definition: mdspan.hpp:366
 
constexpr std::ptrdiff_t DoMapping_(index_sequence< Is... >, IndexType... indices) const noexcept
Definition: mdspan.hpp:385
 
static constexpr bool is_always_unique() noexcept
Definition: mdspan.hpp:362
 
static constexpr bool is_always_strided() noexcept
Definition: mdspan.hpp:364
 
constexpr std::ptrdiff_t stride(std::size_t r) const noexcept
Definition: mdspan.hpp:354
 
constexpr mapping(mapping &&)=default
Implicit Conversion from Extents.
 
Definition: mdspan.hpp:402
 
static constexpr bool is_always_unique() noexcept
Definition: mdspan.hpp:435
 
constexpr const Extents & extents() const noexcept
Definition: mdspan.hpp:412
 
mapping & operator=(mapping &&) noexcept=default
 
constexpr mapping(mapping &&)=default
 
constexpr mapping(const mapping &)=default
 
constexpr std::ptrdiff_t DoMapping_(index_sequence< Is... >, IndexType... indices) const noexcept
Definition: mdspan.hpp:457
 
constexpr std::ptrdiff_t required_span_size() const noexcept
Definition: mdspan.hpp:414
 
static constexpr bool is_always_strided() noexcept
Definition: mdspan.hpp:437
 
constexpr bool operator!=(const mapping< OtherExtents > &other) const noexcept
Definition: mdspan.hpp:450
 
constexpr mapping()=default
 
constexpr bool operator==(const mapping< OtherExtents > &other) const noexcept
Definition: mdspan.hpp:444
 
constexpr bool is_contiguous() const noexcept
Definition: mdspan.hpp:440
 
static constexpr bool is_always_contiguous() noexcept
Definition: mdspan.hpp:436
 
constexpr std::ptrdiff_t stride(std::size_t r) const noexcept
Definition: mdspan.hpp:427
 
constexpr bool is_unique() const noexcept
Definition: mdspan.hpp:439
 
constexpr bool is_strided() const noexcept
Definition: mdspan.hpp:441
 
mapping & operator=(const mapping &) noexcept=default
 
Definition: mdspan.hpp:473
 
static constexpr bool is_always_contiguous() noexcept
Definition: mdspan.hpp:527
 
std::array< std::ptrdiff_t, Extents::rank()> strides_
Definition: mdspan.hpp:548
 
constexpr const std::array< std::ptrdiff_t, Extents::rank()> & strides() const noexcept
Definition: mdspan.hpp:498
 
std::ptrdiff_t stride(size_t rank) const noexcept
Definition: mdspan.hpp:534
 
constexpr std::ptrdiff_t required_span_size() const noexcept
Definition: mdspan.hpp:503
 
static constexpr bool is_always_strided() noexcept
Definition: mdspan.hpp:528
 
constexpr bool is_contiguous() const noexcept
Definition: mdspan.hpp:531
 
constexpr bool is_unique() const noexcept
Definition: mdspan.hpp:530
 
static constexpr bool is_always_unique() noexcept
Definition: mdspan.hpp:526
 
constexpr const Extents & extents() const noexcept
Definition: mdspan.hpp:496
 
constexpr bool operator!=(const mapping< OtherExtents > &other) const noexcept
Definition: mdspan.hpp:542
 
constexpr mapping(const Extents &e, const std::array< std::ptrdiff_t, Extents::rank()> &s) noexcept
Definition: mdspan.hpp:478
 
constexpr mapping(const layout_left::mapping< Extents > &other)
Definition: mdspan.hpp:492
 
std::array< std::ptrdiff_t, Extents::rank()> MakeStrides(const layout_left::mapping< Extents > &other)
Definition: mdspan.hpp:484
 
constexpr mapping()=default
 
constexpr bool operator==(const mapping< OtherExtents > &other) const noexcept
Definition: mdspan.hpp:537
 
constexpr bool is_strided() const noexcept
Definition: mdspan.hpp:532
 
A span is a view over a contiguous sequence of objects, the storage of which is owned by some other o...
Definition: span.hpp:81
 
The fub namespace.
Definition: AnyBoundaryCondition.hpp:31
 
integer_sequence< std::size_t, Is... > index_sequence
Definition: type_traits.hpp:156
 
constexpr std::ptrdiff_t Size_(const extents< StaticExtents... > e) noexcept
Definition: mdspan.hpp:282
 
typename dynamic_extents_< make_index_sequence< Rank > >::type dynamic_extents
Definition: mdspan.hpp:725
 
make_integer_sequence< std::size_t, N > make_index_sequence
Definition: type_traits.hpp:173
 
std::integral_constant< bool, Bool > bool_constant
Definition: type_traits.hpp:181
 
mdspan_subspan_t< ElementType, Extents, LayoutPolicy, AccessorPolicy, SliceSpecifiers... > subspan(const basic_mdspan< ElementType, Extents, LayoutPolicy, AccessorPolicy > &src, SliceSpecifiers... slices) noexcept
Definition: mdspan.hpp:968
 
static constexpr bool is_mdspan_v
Definition: mdspan.hpp:990
 
bool operator==(const IndexBox< Rank > &b1, const IndexBox< Rank > &b2)
Definition: PatchDataView.hpp:63
 
constexpr std::size_t count_dynamic_extents(IndexType... extent) noexcept
Definition: mdspan.hpp:190
 
static constexpr std::ptrdiff_t dynamic_extent
This is a magic value to denote runtime-known extents.
Definition: dynamic_extent.hpp:28
 
constexpr std::ptrdiff_t SliceExtent_(const std::pair< std::ptrdiff_t, std::ptrdiff_t > &p)
Definition: mdspan.hpp:783
 
typename mdspan_subspan< ElementType, Extents, LayoutPolicy, AccessorPolicy, SliceSpecifiers... >::type mdspan_subspan_t
Definition: mdspan.hpp:780
 
dynamic_extents< static_cast< std::size_t >Rank)> Extents(const BasicView< State, Layout, Rank > &view)
Definition: State.hpp:480
 
bool operator!=(const IndexBox< Rank > &b1, const IndexBox< Rank > &b2)
Definition: PatchDataView.hpp:68
 
auto Slice(const BasicView< T, L, Rank > &view, SliceSpecifier slice)
Definition: State.hpp:688
 
static constexpr all_type all
Definition: mdspan.hpp:741
 
std::ptrdiff_t index
Definition: type_traits.hpp:179
 
static constexpr bool is_extents_v
Definition: mdspan.hpp:255
 
Definition: mdspan.hpp:553
 
ElementType element_type
Definition: mdspan.hpp:555
 
constexpr pointer decay(pointer p) const noexcept
Definition: mdspan.hpp:567
 
ElementType & reference
Definition: mdspan.hpp:556
 
ElementType * pointer
Definition: mdspan.hpp:557
 
constexpr reference access(pointer p, ptrdiff_t i) const noexcept
Definition: mdspan.hpp:563
 
constexpr pointer offset(pointer p, ptrdiff_t i) const noexcept
Definition: mdspan.hpp:559
 
Definition: mdspan.hpp:738
 
Definition: type_traits.hpp:123
 
Definition: mdspan.hpp:716
 
Definition: type_traits.hpp:149
 
This is true std::true_type iff E is extents<Es...> for some std::ptrdiff_t...
Definition: mdspan.hpp:252
 
Definition: mdspan.hpp:985
 
This layout creates mappings which do row first indexing (as in Fortran).
Definition: mdspan.hpp:296
 
Definition: mdspan.hpp:401
 
Definition: mdspan.hpp:472
 
Definition: mdspan.hpp:768
 
static constexpr std::size_t slice_rank
Definition: mdspan.hpp:769
 
dynamic_extents< slice_rank > extents_t
Definition: mdspan.hpp:770
 
layout_stride layout_t
Definition: mdspan.hpp:771
 
This file adds basic type traits utilities which are not yet implemented in all standard libraries.