Belle II Software development
span< T > Class Template Reference

Classes

class  iterator
 

Public Types

using element_type = T
 
using value_type = std::remove_cv_t< T >
 
using size_type = std::size_t
 
using difference_type = std::ptrdiff_t
 
using pointer = T *
 
using reference = T &
 

Public Member Functions

 span (std::byte *ptr, size_type count, size_type stride=sizeof(T))
 
reference operator[] (size_type idx) const
 
pointer data () const noexcept
 
size_type size () const noexcept
 
size_type stride () const noexcept
 
iterator begin () const noexcept
 
iterator end () const noexcept
 

Private Attributes

std::byte * m_ptr
 
size_type m_count
 
size_type m_stride
 

Detailed Description

template<typename T>
class nt::span< T >

Definition at line 34 of file ntuples_full.h.

Member Typedef Documentation

◆ difference_type

using difference_type = std::ptrdiff_t

Definition at line 39 of file ntuples_full.h.

◆ element_type

using element_type = T

Definition at line 36 of file ntuples_full.h.

◆ pointer

using pointer = T*

Definition at line 40 of file ntuples_full.h.

◆ reference

using reference = T&

Definition at line 41 of file ntuples_full.h.

◆ size_type

using size_type = std::size_t

Definition at line 38 of file ntuples_full.h.

◆ value_type

using value_type = std::remove_cv_t<T>

Definition at line 37 of file ntuples_full.h.

Constructor & Destructor Documentation

◆ span()

span ( std::byte *  ptr,
size_type  count,
size_type  stride = sizeof(T) 
)
inline

Definition at line 85 of file ntuples_full.h.

86 : m_ptr(ptr), m_count(count), m_stride(stride) {}

Member Function Documentation

◆ begin()

iterator begin ( ) const
inlinenoexcept

Definition at line 108 of file ntuples_full.h.

109 {
110 return iterator(m_ptr, m_stride);
111 }

◆ data()

pointer data ( ) const
inlinenoexcept

Definition at line 93 of file ntuples_full.h.

94 {
95 return reinterpret_cast<pointer>(m_ptr);
96 }

◆ end()

iterator end ( ) const
inlinenoexcept

Definition at line 113 of file ntuples_full.h.

114 {
115 return iterator(m_ptr + m_count * m_stride, m_stride);
116 }

◆ operator[]()

reference operator[] ( size_type  idx) const
inline

Definition at line 88 of file ntuples_full.h.

89 {
90 return *reinterpret_cast<pointer>(m_ptr + idx * m_stride);
91 }

◆ size()

size_type size ( ) const
inlinenoexcept

Definition at line 98 of file ntuples_full.h.

99 {
100 return m_count;
101 }

◆ stride()

size_type stride ( ) const
inlinenoexcept

Definition at line 103 of file ntuples_full.h.

104 {
105 return m_stride;
106 }

Member Data Documentation

◆ m_count

size_type m_count
private

Definition at line 120 of file ntuples_full.h.

◆ m_ptr

std::byte* m_ptr
private

Definition at line 119 of file ntuples_full.h.

◆ m_stride

size_type m_stride
private

Definition at line 121 of file ntuples_full.h.


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