OTB  9.0.0
Orfeo Toolbox
Public Types | Public Member Functions | List of all members
otb::basic_mdspan< ElementType, Extents, LayoutPolicy > Class Template Reference

#include <otbMdSpan.h>

+ Inheritance diagram for otb::basic_mdspan< ElementType, Extents, LayoutPolicy >:

Public Types

using difference_type = ptrdiff_t
 
using element_type = ElementType
 
using extents_type = Extents
 
using index_type = ptrdiff_t
 
using layout_type = LayoutPolicy
 
using mapping_type = typename layout_type::template mapping< extents_type >
 
using pointer = element_type *
 
using reference = element_type &
 
using value_type = std::remove_cv_t< element_type >
 

Public Member Functions

constexpr basic_mdspan () noexcept=default
 
constexpr basic_mdspan (basic_mdspan &&) noexcept=default
 
constexpr basic_mdspan (basic_mdspan const &) noexcept=default
 
pointer m_ptr = nullptr
 
mapping_type m_map
 
template<class... IndexType>
constexpr basic_mdspan (pointer p, IndexType... dynamic_extents) noexcept
 
template<class... IndexType>
constexpr basic_mdspan (pointer p, narrow, IndexType... dynamic_extents) noexcept
 
template<class IndexType , vcl_size_t N>
constexpr basic_mdspan (pointer p, std::array< IndexType, N > const &dynamic_extents) noexcept
 
constexpr basic_mdspan (pointer p, mapping_type const &m) noexcept
 
template<class OtherElementType , class OtherExtents , class OtherLayoutPolicy >
constexpr basic_mdspan (const basic_mdspan< OtherElementType, OtherExtents, OtherLayoutPolicy > &other) noexcept
 
 ~basic_mdspan ()=default
 
constexpr basic_mdspanoperator= (basic_mdspan const &) noexcept=default
 
constexpr basic_mdspanoperator= (basic_mdspan &&) noexcept=default
 
template<class OtherElementType , class OtherExtents , class OtherLayoutPolicy >
constexpr basic_mdspanoperator= (const basic_mdspan< OtherElementType, OtherExtents, OtherLayoutPolicy > &other) noexcept
 
constexpr reference operator[] (index_type) const noexcept
 
template<class... IndexType>
constexpr reference operator() (IndexType... indices) const noexcept
 
template<class IndexType , vcl_size_t N>
constexpr reference operator() (std::array< IndexType, N > const &indices) const noexcept
 
constexpr extents_type extents () const noexcept
 
constexpr index_type extent (vcl_size_t k) const noexcept
 
constexpr index_type size () const noexcept
 
constexpr index_type unique_size () const noexcept
 
constexpr Span< element_typespan () const noexcept
 
constexpr pointer data () const noexcept
 
constexpr mapping_type mapping () const noexcept
 
constexpr bool is_unique () const noexcept
 
constexpr bool is_contiguous () const noexcept
 
constexpr bool is_strided () const noexcept
 
constexpr index_type stride (vcl_size_t k) const noexcept
 
static constexpr int rank () noexcept
 
static constexpr int rank_dynamic () noexcept
 
static constexpr index_type static_extent (vcl_size_t k) noexcept
 
static constexpr bool is_always_unique () noexcept
 
static constexpr bool is_always_contiguous () noexcept
 
static constexpr bool is_always_strided () noexcept
 

Detailed Description

template<class ElementType, class Extents, class LayoutPolicy = layout_right>
class otb::basic_mdspan< ElementType, Extents, LayoutPolicy >

Multidensional Span class inspired by C++ p0009r9 draft proposal. [mdspan.basic], class template mdspan

See also
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p0009r9.html
https://github.com/ORNL/cpp-proposals-pub/blob/master/P0009/reference-implementation
Note
AccessorPolicy is not implemented.

Definition at line 41 of file otbMdSpan.h.

Member Typedef Documentation

◆ difference_type

template<class ElementType , class Extents , class LayoutPolicy = layout_right>
using otb::basic_mdspan< ElementType, Extents, LayoutPolicy >::difference_type = ptrdiff_t

Definition at line 54 of file otbMdSpan.h.

◆ element_type

template<class ElementType , class Extents , class LayoutPolicy = layout_right>
using otb::basic_mdspan< ElementType, Extents, LayoutPolicy >::element_type = ElementType

Definition at line 51 of file otbMdSpan.h.

◆ extents_type

template<class ElementType , class Extents , class LayoutPolicy = layout_right>
using otb::basic_mdspan< ElementType, Extents, LayoutPolicy >::extents_type = Extents

Definition at line 46 of file otbMdSpan.h.

◆ index_type

template<class ElementType , class Extents , class LayoutPolicy = layout_right>
using otb::basic_mdspan< ElementType, Extents, LayoutPolicy >::index_type = ptrdiff_t

Definition at line 53 of file otbMdSpan.h.

◆ layout_type

template<class ElementType , class Extents , class LayoutPolicy = layout_right>
using otb::basic_mdspan< ElementType, Extents, LayoutPolicy >::layout_type = LayoutPolicy

Definition at line 47 of file otbMdSpan.h.

◆ mapping_type

template<class ElementType , class Extents , class LayoutPolicy = layout_right>
using otb::basic_mdspan< ElementType, Extents, LayoutPolicy >::mapping_type = typename layout_type::template mapping<extents_type>

Definition at line 49 of file otbMdSpan.h.

◆ pointer

template<class ElementType , class Extents , class LayoutPolicy = layout_right>
using otb::basic_mdspan< ElementType, Extents, LayoutPolicy >::pointer = element_type*

Definition at line 55 of file otbMdSpan.h.

◆ reference

template<class ElementType , class Extents , class LayoutPolicy = layout_right>
using otb::basic_mdspan< ElementType, Extents, LayoutPolicy >::reference = element_type&

Definition at line 56 of file otbMdSpan.h.

◆ value_type

template<class ElementType , class Extents , class LayoutPolicy = layout_right>
using otb::basic_mdspan< ElementType, Extents, LayoutPolicy >::value_type = std::remove_cv_t<element_type>

Definition at line 52 of file otbMdSpan.h.

Constructor & Destructor Documentation

◆ basic_mdspan() [1/8]

template<class ElementType , class Extents , class LayoutPolicy = layout_right>
constexpr otb::basic_mdspan< ElementType, Extents, LayoutPolicy >::basic_mdspan ( )
constexprdefaultnoexcept

◆ basic_mdspan() [2/8]

template<class ElementType , class Extents , class LayoutPolicy = layout_right>
constexpr otb::basic_mdspan< ElementType, Extents, LayoutPolicy >::basic_mdspan ( basic_mdspan< ElementType, Extents, LayoutPolicy > const &  )
constexprdefaultnoexcept

◆ basic_mdspan() [3/8]

template<class ElementType , class Extents , class LayoutPolicy = layout_right>
constexpr otb::basic_mdspan< ElementType, Extents, LayoutPolicy >::basic_mdspan ( basic_mdspan< ElementType, Extents, LayoutPolicy > &&  )
constexprdefaultnoexcept

◆ basic_mdspan() [4/8]

template<class ElementType , class Extents , class LayoutPolicy = layout_right>
template<class... IndexType>
constexpr otb::basic_mdspan< ElementType, Extents, LayoutPolicy >::basic_mdspan ( pointer  p,
IndexType...  dynamic_extents 
)
inlineexplicitconstexprnoexcept

Constructs from extent list. This flavour will emit warning: narrowing conversion of messages when passing size_t values instead of ptrdiff_t ones.

Definition at line 68 of file otbMdSpan.h.

◆ basic_mdspan() [5/8]

template<class ElementType , class Extents , class LayoutPolicy = layout_right>
template<class... IndexType>
constexpr otb::basic_mdspan< ElementType, Extents, LayoutPolicy >::basic_mdspan ( pointer  p,
narrow  ,
IndexType...  dynamic_extents 
)
inlineconstexprnoexcept

Constructs from extent list, ignore narrowing warnings. This flavour will ignore warning: narrowing conversion of messages without relying on the global -Wnarrowing flag.

Useful to directly use size_t values instead of ptrdiff_t ones.

Definition at line 81 of file otbMdSpan.h.

◆ basic_mdspan() [6/8]

template<class ElementType , class Extents , class LayoutPolicy = layout_right>
template<class IndexType , vcl_size_t N>
constexpr otb::basic_mdspan< ElementType, Extents, LayoutPolicy >::basic_mdspan ( pointer  p,
std::array< IndexType, N > const &  dynamic_extents 
)
inlineconstexprnoexcept

Constructs from array of extents.

Definition at line 89 of file otbMdSpan.h.

◆ basic_mdspan() [7/8]

template<class ElementType , class Extents , class LayoutPolicy = layout_right>
constexpr otb::basic_mdspan< ElementType, Extents, LayoutPolicy >::basic_mdspan ( pointer  p,
mapping_type const &  m 
)
inlineconstexprnoexcept

Constructs from a layout representation.

Definition at line 96 of file otbMdSpan.h.

◆ basic_mdspan() [8/8]

template<class ElementType , class Extents , class LayoutPolicy = layout_right>
template<class OtherElementType , class OtherExtents , class OtherLayoutPolicy >
constexpr otb::basic_mdspan< ElementType, Extents, LayoutPolicy >::basic_mdspan ( const basic_mdspan< OtherElementType, OtherExtents, OtherLayoutPolicy > &  other)
inlineconstexprnoexcept

Constructs from extent list. This flavour will emit warning: narrowing conversion of messages when passing size_t values instead of ptrdiff_t ones.

Definition at line 100 of file otbMdSpan.h.

◆ ~basic_mdspan()

template<class ElementType , class Extents , class LayoutPolicy = layout_right>
otb::basic_mdspan< ElementType, Extents, LayoutPolicy >::~basic_mdspan ( )
default

Constructs from extent list. This flavour will emit warning: narrowing conversion of messages when passing size_t values instead of ptrdiff_t ones.

Member Function Documentation

◆ data()

template<class ElementType , class Extents , class LayoutPolicy = layout_right>
constexpr pointer otb::basic_mdspan< ElementType, Extents, LayoutPolicy >::data ( ) const
inlineconstexprnoexcept

Constructs from extent list. This flavour will emit warning: narrowing conversion of messages when passing size_t values instead of ptrdiff_t ones.

Definition at line 157 of file otbMdSpan.h.

Referenced by otb::basic_mdspan< double, dynamic_extent, dynamic_extent >::span().

◆ extent()

template<class ElementType , class Extents , class LayoutPolicy = layout_right>
constexpr index_type otb::basic_mdspan< ElementType, Extents, LayoutPolicy >::extent ( vcl_size_t  k) const
inlineconstexprnoexcept

Constructs from extent list. This flavour will emit warning: narrowing conversion of messages when passing size_t values instead of ptrdiff_t ones.

Definition at line 141 of file otbMdSpan.h.

Referenced by otb::basic_mdspan< double, dynamic_extent, dynamic_extent >::size().

◆ extents()

template<class ElementType , class Extents , class LayoutPolicy = layout_right>
constexpr extents_type otb::basic_mdspan< ElementType, Extents, LayoutPolicy >::extents ( ) const
inlineconstexprnoexcept

Constructs from extent list. This flavour will emit warning: narrowing conversion of messages when passing size_t values instead of ptrdiff_t ones.

Definition at line 139 of file otbMdSpan.h.

Referenced by otb::basic_mdspan< double, dynamic_extent, dynamic_extent >::extent().

◆ is_always_contiguous()

template<class ElementType , class Extents , class LayoutPolicy = layout_right>
static constexpr bool otb::basic_mdspan< ElementType, Extents, LayoutPolicy >::is_always_contiguous ( )
inlinestaticconstexprnoexcept

Constructs from extent list. This flavour will emit warning: narrowing conversion of messages when passing size_t values instead of ptrdiff_t ones.

Definition at line 163 of file otbMdSpan.h.

◆ is_always_strided()

template<class ElementType , class Extents , class LayoutPolicy = layout_right>
static constexpr bool otb::basic_mdspan< ElementType, Extents, LayoutPolicy >::is_always_strided ( )
inlinestaticconstexprnoexcept

Constructs from extent list. This flavour will emit warning: narrowing conversion of messages when passing size_t values instead of ptrdiff_t ones.

Definition at line 165 of file otbMdSpan.h.

◆ is_always_unique()

template<class ElementType , class Extents , class LayoutPolicy = layout_right>
static constexpr bool otb::basic_mdspan< ElementType, Extents, LayoutPolicy >::is_always_unique ( )
inlinestaticconstexprnoexcept

Constructs from extent list. This flavour will emit warning: narrowing conversion of messages when passing size_t values instead of ptrdiff_t ones.

Definition at line 161 of file otbMdSpan.h.

◆ is_contiguous()

template<class ElementType , class Extents , class LayoutPolicy = layout_right>
constexpr bool otb::basic_mdspan< ElementType, Extents, LayoutPolicy >::is_contiguous ( ) const
inlineconstexprnoexcept

Constructs from extent list. This flavour will emit warning: narrowing conversion of messages when passing size_t values instead of ptrdiff_t ones.

Definition at line 172 of file otbMdSpan.h.

◆ is_strided()

template<class ElementType , class Extents , class LayoutPolicy = layout_right>
constexpr bool otb::basic_mdspan< ElementType, Extents, LayoutPolicy >::is_strided ( ) const
inlineconstexprnoexcept

Constructs from extent list. This flavour will emit warning: narrowing conversion of messages when passing size_t values instead of ptrdiff_t ones.

Definition at line 174 of file otbMdSpan.h.

◆ is_unique()

template<class ElementType , class Extents , class LayoutPolicy = layout_right>
constexpr bool otb::basic_mdspan< ElementType, Extents, LayoutPolicy >::is_unique ( ) const
inlineconstexprnoexcept

Constructs from extent list. This flavour will emit warning: narrowing conversion of messages when passing size_t values instead of ptrdiff_t ones.

Definition at line 170 of file otbMdSpan.h.

◆ mapping()

template<class ElementType , class Extents , class LayoutPolicy = layout_right>
constexpr mapping_type otb::basic_mdspan< ElementType, Extents, LayoutPolicy >::mapping ( ) const
inlineconstexprnoexcept

◆ operator()() [1/2]

template<class ElementType , class Extents , class LayoutPolicy = layout_right>
template<class... IndexType>
constexpr reference otb::basic_mdspan< ElementType, Extents, LayoutPolicy >::operator() ( IndexType...  indices) const
inlineconstexprnoexcept

Constructs from extent list. This flavour will emit warning: narrowing conversion of messages when passing size_t values instead of ptrdiff_t ones.

Definition at line 120 of file otbMdSpan.h.

◆ operator()() [2/2]

template<class ElementType , class Extents , class LayoutPolicy = layout_right>
template<class IndexType , vcl_size_t N>
constexpr reference otb::basic_mdspan< ElementType, Extents, LayoutPolicy >::operator() ( std::array< IndexType, N > const &  indices) const
inlineconstexprnoexcept

Constructs from extent list. This flavour will emit warning: narrowing conversion of messages when passing size_t values instead of ptrdiff_t ones.

Definition at line 126 of file otbMdSpan.h.

◆ operator=() [1/3]

template<class ElementType , class Extents , class LayoutPolicy = layout_right>
constexpr basic_mdspan& otb::basic_mdspan< ElementType, Extents, LayoutPolicy >::operator= ( basic_mdspan< ElementType, Extents, LayoutPolicy > &&  )
constexprdefaultnoexcept

Constructs from extent list. This flavour will emit warning: narrowing conversion of messages when passing size_t values instead of ptrdiff_t ones.

◆ operator=() [2/3]

template<class ElementType , class Extents , class LayoutPolicy = layout_right>
constexpr basic_mdspan& otb::basic_mdspan< ElementType, Extents, LayoutPolicy >::operator= ( basic_mdspan< ElementType, Extents, LayoutPolicy > const &  )
constexprdefaultnoexcept

Constructs from extent list. This flavour will emit warning: narrowing conversion of messages when passing size_t values instead of ptrdiff_t ones.

◆ operator=() [3/3]

template<class ElementType , class Extents , class LayoutPolicy = layout_right>
template<class OtherElementType , class OtherExtents , class OtherLayoutPolicy >
constexpr basic_mdspan& otb::basic_mdspan< ElementType, Extents, LayoutPolicy >::operator= ( const basic_mdspan< OtherElementType, OtherExtents, OtherLayoutPolicy > &  other)
inlineconstexprnoexcept

Constructs from extent list. This flavour will emit warning: narrowing conversion of messages when passing size_t values instead of ptrdiff_t ones.

Definition at line 110 of file otbMdSpan.h.

◆ operator[]()

template<class ElementType , class Extents , class LayoutPolicy = layout_right>
constexpr reference otb::basic_mdspan< ElementType, Extents, LayoutPolicy >::operator[] ( index_type  ) const
constexprnoexcept

Constructs from extent list. This flavour will emit warning: narrowing conversion of messages when passing size_t values instead of ptrdiff_t ones.

◆ rank()

template<class ElementType , class Extents , class LayoutPolicy = layout_right>
static constexpr int otb::basic_mdspan< ElementType, Extents, LayoutPolicy >::rank ( )
inlinestaticconstexprnoexcept

Constructs from extent list. This flavour will emit warning: narrowing conversion of messages when passing size_t values instead of ptrdiff_t ones.

Definition at line 132 of file otbMdSpan.h.

Referenced by otb::basic_mdspan< double, dynamic_extent, dynamic_extent >::size().

◆ rank_dynamic()

template<class ElementType , class Extents , class LayoutPolicy = layout_right>
static constexpr int otb::basic_mdspan< ElementType, Extents, LayoutPolicy >::rank_dynamic ( )
inlinestaticconstexprnoexcept

Constructs from extent list. This flavour will emit warning: narrowing conversion of messages when passing size_t values instead of ptrdiff_t ones.

Definition at line 134 of file otbMdSpan.h.

◆ size()

template<class ElementType , class Extents , class LayoutPolicy = layout_right>
constexpr index_type otb::basic_mdspan< ElementType, Extents, LayoutPolicy >::size ( ) const
inlineconstexprnoexcept

Constructs from extent list. This flavour will emit warning: narrowing conversion of messages when passing size_t values instead of ptrdiff_t ones.

Definition at line 143 of file otbMdSpan.h.

◆ span()

template<class ElementType , class Extents , class LayoutPolicy = layout_right>
constexpr Span<element_type> otb::basic_mdspan< ElementType, Extents, LayoutPolicy >::span ( ) const
inlineconstexprnoexcept

Constructs from extent list. This flavour will emit warning: narrowing conversion of messages when passing size_t values instead of ptrdiff_t ones.

Definition at line 155 of file otbMdSpan.h.

◆ static_extent()

template<class ElementType , class Extents , class LayoutPolicy = layout_right>
static constexpr index_type otb::basic_mdspan< ElementType, Extents, LayoutPolicy >::static_extent ( vcl_size_t  k)
inlinestaticconstexprnoexcept

Constructs from extent list. This flavour will emit warning: narrowing conversion of messages when passing size_t values instead of ptrdiff_t ones.

Definition at line 136 of file otbMdSpan.h.

◆ stride()

template<class ElementType , class Extents , class LayoutPolicy = layout_right>
constexpr index_type otb::basic_mdspan< ElementType, Extents, LayoutPolicy >::stride ( vcl_size_t  k) const
inlineconstexprnoexcept

Constructs from extent list. This flavour will emit warning: narrowing conversion of messages when passing size_t values instead of ptrdiff_t ones.

Definition at line 176 of file otbMdSpan.h.

◆ unique_size()

template<class ElementType , class Extents , class LayoutPolicy = layout_right>
constexpr index_type otb::basic_mdspan< ElementType, Extents, LayoutPolicy >::unique_size ( ) const
constexprnoexcept

Constructs from extent list. This flavour will emit warning: narrowing conversion of messages when passing size_t values instead of ptrdiff_t ones.

Member Data Documentation

◆ m_map

template<class ElementType , class Extents , class LayoutPolicy = layout_right>
mapping_type otb::basic_mdspan< ElementType, Extents, LayoutPolicy >::m_map
private

Constructs from extent list. This flavour will emit warning: narrowing conversion of messages when passing size_t values instead of ptrdiff_t ones.

Definition at line 181 of file otbMdSpan.h.

Referenced by otb::basic_mdspan< double, dynamic_extent, dynamic_extent >::extents(), otb::basic_mdspan< double, dynamic_extent, dynamic_extent >::mapping(), otb::basic_mdspan< double, dynamic_extent, dynamic_extent >::operator()(), and otb::basic_mdspan< double, dynamic_extent, dynamic_extent >::operator=().

◆ m_ptr

template<class ElementType , class Extents , class LayoutPolicy = layout_right>
pointer otb::basic_mdspan< ElementType, Extents, LayoutPolicy >::m_ptr = nullptr
private

Constructs from extent list. This flavour will emit warning: narrowing conversion of messages when passing size_t values instead of ptrdiff_t ones.

Definition at line 180 of file otbMdSpan.h.

Referenced by otb::basic_mdspan< double, dynamic_extent, dynamic_extent >::data(), otb::basic_mdspan< double, dynamic_extent, dynamic_extent >::operator()(), and otb::basic_mdspan< double, dynamic_extent, dynamic_extent >::operator=().


The documentation for this class was generated from the following file: