matio-cpp  v0.2.5
A C++ wrapper of the matio library, with memory ownership handling, to read and write .mat files.
matioCpp::Span< ElementType, Extent > Class Template Reference

#include <matioCpp/Span.h>

Public Types

using element_type = ElementType
 
using value_type = std::remove_cv_t< ElementType >
 
using index_type = std::ptrdiff_t
 
using pointer = element_type *
 
using reference = element_type &
 
using const_reference = const element_type &
 
using iterator = details::span_iterator< Span< ElementType, Extent >, false >
 
using const_iterator = details::span_iterator< Span< ElementType, Extent >, true >
 
using reverse_iterator = std::reverse_iterator< iterator >
 
using const_reverse_iterator = std::reverse_iterator< const_iterator >
 
using size_type = index_type
 

Public Member Functions

template<bool Dependent = false, class = std::enable_if_t<(Dependent || Extent <= 0)>>
MATIOCPP_CONSTEXPR Span () noexcept
 
MATIOCPP_CONSTEXPR Span (pointer ptr, index_type count)
 
MATIOCPP_CONSTEXPR Span (pointer firstElem, pointer lastElem)
 
template<std::size_t N>
MATIOCPP_CONSTEXPR Span (element_type(&arr)[N]) noexcept
 
template<std::size_t N, class ArrayElementType = std::remove_const_t<element_type>>
MATIOCPP_CONSTEXPR Span (std::array< ArrayElementType, N > &arr) noexcept
 
template<std::size_t N>
MATIOCPP_CONSTEXPR Span (const std::array< std::remove_const_t< element_type >, N > &arr) noexcept
 
template<class Container , class = std::enable_if_t<SpanUtils::has_data_method<Container>::value && SpanUtils::has_size_method<Container>::value>>
MATIOCPP_CONSTEXPR Span (Container &cont)
 
template<class Container , class = std::enable_if_t<SpanUtils::has_data_method<Container>::value && SpanUtils::has_size_method<Container>::value>>
MATIOCPP_CONSTEXPR Span (const Container &cont)
 
MATIOCPP_CONSTEXPR Span (const Span &other) noexcept=default
 
template<class OtherElementType , std::ptrdiff_t OtherExtent, class = std::enable_if_t< details::is_allowed_extent_conversion<OtherExtent, Extent>::value && details::is_allowed_element_type_conversion<OtherElementType, element_type>::value>>
MATIOCPP_CONSTEXPR Span (const Span< OtherElementType, OtherExtent > &other)
 
 ~Span () noexcept=default
 
MATIOCPP_CONSTEXPR Spanoperator= (const Span &other) noexcept=default
 
template<std::ptrdiff_t Count>
MATIOCPP_CONSTEXPR Span< element_type, Count > first () const
 
template<std::ptrdiff_t Count>
MATIOCPP_CONSTEXPR Span< element_type, Count > last () const
 
template<std::ptrdiff_t Offset, std::ptrdiff_t Count = dynamic_extent>
MATIOCPP_CONSTEXPR auto subspan () const -> typename details::calculate_subspan_type< ElementType, Extent, Offset, Count >::type
 
MATIOCPP_CONSTEXPR Span< element_type, dynamic_extentfirst (index_type count) const
 
MATIOCPP_CONSTEXPR Span< element_type, dynamic_extentlast (index_type count) const
 
MATIOCPP_CONSTEXPR Span< element_type, dynamic_extentsubspan (index_type offset, index_type count=dynamic_extent) const
 
MATIOCPP_CONSTEXPR index_type size () const noexcept
 
MATIOCPP_CONSTEXPR index_type size_bytes () const noexcept
 
MATIOCPP_CONSTEXPR bool empty () const noexcept
 
MATIOCPP_CONSTEXPR reference operator[] (index_type idx) const
 
MATIOCPP_CONSTEXPR const_reference getVal (index_type idx) const
 
MATIOCPP_CONSTEXPR bool setVal (index_type idx, const_reference val)
 
MATIOCPP_CONSTEXPR reference at (index_type idx) const
 
MATIOCPP_CONSTEXPR reference operator() (index_type idx) const
 
MATIOCPP_CONSTEXPR pointer data () const noexcept
 
MATIOCPP_CONSTEXPR iterator begin () const noexcept
 
MATIOCPP_CONSTEXPR iterator end () const noexcept
 
MATIOCPP_CONSTEXPR const_iterator cbegin () const noexcept
 
MATIOCPP_CONSTEXPR const_iterator cend () const noexcept
 
MATIOCPP_CONSTEXPR reverse_iterator rbegin () const noexcept
 
MATIOCPP_CONSTEXPR reverse_iterator rend () const noexcept
 
MATIOCPP_CONSTEXPR const_reverse_iterator crbegin () const noexcept
 
MATIOCPP_CONSTEXPR const_reverse_iterator crend () const noexcept
 

Static Public Attributes

static constexpr index_type extent { Extent }
 

Detailed Description

template<class ElementType, std::ptrdiff_t Extent>
class matioCpp::Span< ElementType, Extent >

Definition at line 382 of file Span.h.

Member Typedef Documentation

◆ const_iterator

template<class ElementType , std::ptrdiff_t Extent>
using matioCpp::Span< ElementType, Extent >::const_iterator = details::span_iterator<Span<ElementType, Extent>, true>

Definition at line 394 of file Span.h.

◆ const_reference

template<class ElementType , std::ptrdiff_t Extent>
using matioCpp::Span< ElementType, Extent >::const_reference = const element_type&

Definition at line 391 of file Span.h.

◆ const_reverse_iterator

template<class ElementType , std::ptrdiff_t Extent>
using matioCpp::Span< ElementType, Extent >::const_reverse_iterator = std::reverse_iterator<const_iterator>

Definition at line 396 of file Span.h.

◆ element_type

template<class ElementType , std::ptrdiff_t Extent>
using matioCpp::Span< ElementType, Extent >::element_type = ElementType

Definition at line 386 of file Span.h.

◆ index_type

template<class ElementType , std::ptrdiff_t Extent>
using matioCpp::Span< ElementType, Extent >::index_type = std::ptrdiff_t

Definition at line 388 of file Span.h.

◆ iterator

template<class ElementType , std::ptrdiff_t Extent>
using matioCpp::Span< ElementType, Extent >::iterator = details::span_iterator<Span<ElementType, Extent>, false>

Definition at line 393 of file Span.h.

◆ pointer

template<class ElementType , std::ptrdiff_t Extent>
using matioCpp::Span< ElementType, Extent >::pointer = element_type*

Definition at line 389 of file Span.h.

◆ reference

template<class ElementType , std::ptrdiff_t Extent>
using matioCpp::Span< ElementType, Extent >::reference = element_type&

Definition at line 390 of file Span.h.

◆ reverse_iterator

template<class ElementType , std::ptrdiff_t Extent>
using matioCpp::Span< ElementType, Extent >::reverse_iterator = std::reverse_iterator<iterator>

Definition at line 395 of file Span.h.

◆ size_type

template<class ElementType , std::ptrdiff_t Extent>
using matioCpp::Span< ElementType, Extent >::size_type = index_type

Definition at line 398 of file Span.h.

◆ value_type

template<class ElementType , std::ptrdiff_t Extent>
using matioCpp::Span< ElementType, Extent >::value_type = std::remove_cv_t<ElementType>

Definition at line 387 of file Span.h.

Constructor & Destructor Documentation

◆ Span() [1/10]

template<class ElementType , std::ptrdiff_t Extent>
template<bool Dependent = false, class = std::enable_if_t<(Dependent || Extent <= 0)>>
MATIOCPP_CONSTEXPR matioCpp::Span< ElementType, Extent >::Span ( )
inlinenoexcept

Definition at line 412 of file Span.h.

◆ Span() [2/10]

template<class ElementType , std::ptrdiff_t Extent>
MATIOCPP_CONSTEXPR matioCpp::Span< ElementType, Extent >::Span ( pointer  ptr,
index_type  count 
)
inline

Definition at line 417 of file Span.h.

◆ Span() [3/10]

template<class ElementType , std::ptrdiff_t Extent>
MATIOCPP_CONSTEXPR matioCpp::Span< ElementType, Extent >::Span ( pointer  firstElem,
pointer  lastElem 
)
inline

Definition at line 419 of file Span.h.

◆ Span() [4/10]

template<class ElementType , std::ptrdiff_t Extent>
template<std::size_t N>
MATIOCPP_CONSTEXPR matioCpp::Span< ElementType, Extent >::Span ( element_type(&)  arr[N])
inlinenoexcept

Definition at line 425 of file Span.h.

◆ Span() [5/10]

template<class ElementType , std::ptrdiff_t Extent>
template<std::size_t N, class ArrayElementType = std::remove_const_t<element_type>>
MATIOCPP_CONSTEXPR matioCpp::Span< ElementType, Extent >::Span ( std::array< ArrayElementType, N > &  arr)
inlinenoexcept

Definition at line 431 of file Span.h.

◆ Span() [6/10]

template<class ElementType , std::ptrdiff_t Extent>
template<std::size_t N>
MATIOCPP_CONSTEXPR matioCpp::Span< ElementType, Extent >::Span ( const std::array< std::remove_const_t< element_type >, N > &  arr)
inlinenoexcept

Definition at line 437 of file Span.h.

◆ Span() [7/10]

template<class ElementType , std::ptrdiff_t Extent>
template<class Container , class = std::enable_if_t<SpanUtils::has_data_method<Container>::value && SpanUtils::has_size_method<Container>::value>>
MATIOCPP_CONSTEXPR matioCpp::Span< ElementType, Extent >::Span ( Container &  cont)
inline

Definition at line 450 of file Span.h.

◆ Span() [8/10]

template<class ElementType , std::ptrdiff_t Extent>
template<class Container , class = std::enable_if_t<SpanUtils::has_data_method<Container>::value && SpanUtils::has_size_method<Container>::value>>
MATIOCPP_CONSTEXPR matioCpp::Span< ElementType, Extent >::Span ( const Container &  cont)
inline

Definition at line 459 of file Span.h.

◆ Span() [9/10]

template<class ElementType , std::ptrdiff_t Extent>
MATIOCPP_CONSTEXPR matioCpp::Span< ElementType, Extent >::Span ( const Span< ElementType, Extent > &  other)
defaultnoexcept

◆ Span() [10/10]

template<class ElementType , std::ptrdiff_t Extent>
template<class OtherElementType , std::ptrdiff_t OtherExtent, class = std::enable_if_t< details::is_allowed_extent_conversion<OtherExtent, Extent>::value && details::is_allowed_element_type_conversion<OtherElementType, element_type>::value>>
MATIOCPP_CONSTEXPR matioCpp::Span< ElementType, Extent >::Span ( const Span< OtherElementType, OtherExtent > &  other)
inline

Definition at line 472 of file Span.h.

◆ ~Span()

template<class ElementType , std::ptrdiff_t Extent>
matioCpp::Span< ElementType, Extent >::~Span ( )
defaultnoexcept

Member Function Documentation

◆ at()

template<class ElementType , std::ptrdiff_t Extent>
MATIOCPP_CONSTEXPR reference matioCpp::Span< ElementType, Extent >::at ( index_type  idx) const
inline

Definition at line 548 of file Span.h.

References matioCpp::Span< ElementType, Extent >::operator[]().

◆ begin()

template<class ElementType , std::ptrdiff_t Extent>
MATIOCPP_CONSTEXPR iterator matioCpp::Span< ElementType, Extent >::begin ( ) const
inlinenoexcept

◆ cbegin()

template<class ElementType , std::ptrdiff_t Extent>
MATIOCPP_CONSTEXPR const_iterator matioCpp::Span< ElementType, Extent >::cbegin ( ) const
inlinenoexcept

Definition at line 556 of file Span.h.

Referenced by matioCpp::Span< ElementType, Extent >::crend().

◆ cend()

template<class ElementType , std::ptrdiff_t Extent>
MATIOCPP_CONSTEXPR const_iterator matioCpp::Span< ElementType, Extent >::cend ( ) const
inlinenoexcept

◆ crbegin()

template<class ElementType , std::ptrdiff_t Extent>
MATIOCPP_CONSTEXPR const_reverse_iterator matioCpp::Span< ElementType, Extent >::crbegin ( ) const
inlinenoexcept

Definition at line 562 of file Span.h.

References matioCpp::Span< ElementType, Extent >::cend().

◆ crend()

template<class ElementType , std::ptrdiff_t Extent>
MATIOCPP_CONSTEXPR const_reverse_iterator matioCpp::Span< ElementType, Extent >::crend ( ) const
inlinenoexcept

Definition at line 563 of file Span.h.

References matioCpp::Span< ElementType, Extent >::cbegin().

◆ data()

◆ empty()

template<class ElementType , std::ptrdiff_t Extent>
MATIOCPP_CONSTEXPR bool matioCpp::Span< ElementType, Extent >::empty ( ) const
inlinenoexcept

Definition at line 531 of file Span.h.

References matioCpp::Span< ElementType, Extent >::size().

◆ end()

template<class ElementType , std::ptrdiff_t Extent>
MATIOCPP_CONSTEXPR iterator matioCpp::Span< ElementType, Extent >::end ( ) const
inlinenoexcept

◆ first() [1/2]

template<class ElementType , std::ptrdiff_t Extent>
template<std::ptrdiff_t Count>
MATIOCPP_CONSTEXPR Span<element_type, Count> matioCpp::Span< ElementType, Extent >::first ( ) const
inline

◆ first() [2/2]

template<class ElementType , std::ptrdiff_t Extent>
MATIOCPP_CONSTEXPR Span<element_type, dynamic_extent> matioCpp::Span< ElementType, Extent >::first ( index_type  count) const
inline

◆ getVal()

template<class ElementType , std::ptrdiff_t Extent>
MATIOCPP_CONSTEXPR const_reference matioCpp::Span< ElementType, Extent >::getVal ( index_type  idx) const
inline

Definition at line 540 of file Span.h.

References matioCpp::Span< ElementType, Extent >::operator[]().

◆ last() [1/2]

template<class ElementType , std::ptrdiff_t Extent>
template<std::ptrdiff_t Count>
MATIOCPP_CONSTEXPR Span<element_type, Count> matioCpp::Span< ElementType, Extent >::last ( ) const
inline

◆ last() [2/2]

template<class ElementType , std::ptrdiff_t Extent>
MATIOCPP_CONSTEXPR Span<element_type, dynamic_extent> matioCpp::Span< ElementType, Extent >::last ( index_type  count) const
inline

◆ operator()()

template<class ElementType , std::ptrdiff_t Extent>
MATIOCPP_CONSTEXPR reference matioCpp::Span< ElementType, Extent >::operator() ( index_type  idx) const
inline

Definition at line 549 of file Span.h.

References matioCpp::Span< ElementType, Extent >::operator[]().

◆ operator=()

template<class ElementType , std::ptrdiff_t Extent>
MATIOCPP_CONSTEXPR Span& matioCpp::Span< ElementType, Extent >::operator= ( const Span< ElementType, Extent > &  other)
defaultnoexcept

◆ operator[]()

template<class ElementType , std::ptrdiff_t Extent>
MATIOCPP_CONSTEXPR reference matioCpp::Span< ElementType, Extent >::operator[] ( index_type  idx) const
inline

◆ rbegin()

template<class ElementType , std::ptrdiff_t Extent>
MATIOCPP_CONSTEXPR reverse_iterator matioCpp::Span< ElementType, Extent >::rbegin ( ) const
inlinenoexcept

Definition at line 559 of file Span.h.

References matioCpp::Span< ElementType, Extent >::end().

◆ rend()

template<class ElementType , std::ptrdiff_t Extent>
MATIOCPP_CONSTEXPR reverse_iterator matioCpp::Span< ElementType, Extent >::rend ( ) const
inlinenoexcept

Definition at line 560 of file Span.h.

References matioCpp::Span< ElementType, Extent >::begin().

◆ setVal()

template<class ElementType , std::ptrdiff_t Extent>
MATIOCPP_CONSTEXPR bool matioCpp::Span< ElementType, Extent >::setVal ( index_type  idx,
const_reference  val 
)
inline

Definition at line 541 of file Span.h.

References matioCpp::Span< ElementType, Extent >::data().

◆ size()

◆ size_bytes()

template<class ElementType , std::ptrdiff_t Extent>
MATIOCPP_CONSTEXPR index_type matioCpp::Span< ElementType, Extent >::size_bytes ( ) const
inlinenoexcept

Definition at line 527 of file Span.h.

References matioCpp::Span< ElementType, Extent >::size().

◆ subspan() [1/2]

template<class ElementType , std::ptrdiff_t Extent>
template<std::ptrdiff_t Offset, std::ptrdiff_t Count = dynamic_extent>
MATIOCPP_CONSTEXPR auto matioCpp::Span< ElementType, Extent >::subspan ( ) const -> typename details::calculate_subspan_type<ElementType, Extent, Offset, Count>::type
inline

◆ subspan() [2/2]

template<class ElementType , std::ptrdiff_t Extent>
MATIOCPP_CONSTEXPR Span<element_type, dynamic_extent> matioCpp::Span< ElementType, Extent >::subspan ( index_type  offset,
index_type  count = dynamic_extent 
) const
inline

Definition at line 518 of file Span.h.

Field Documentation

◆ extent

template<class ElementType , std::ptrdiff_t Extent>
constexpr index_type matioCpp::Span< ElementType, Extent >::extent { Extent }
staticconstexpr

Definition at line 403 of file Span.h.


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