OpenWalnut  1.5.0dev
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
WValueSet< T >::SubArray Class Reference

A helper class granting safe access to a certain part of the valueset. More...

#include <WValueSet.h>

+ Collaboration diagram for WValueSet< T >::SubArray:

Public Member Functions

 ~SubArray ()
 Destructor. More...
 
T const & operator[] (std::size_t i) const
 Safe access. More...
 

Private Member Functions

 SubArray (T const *const p, std::size_t size)
 Construct an object that allows safe access. More...
 

Private Attributes

T const *const m_ptr
 the pointer to the first element More...
 
std::size_t const m_size
 the size of the subarray More...
 

Friends

class WValueSet
 make the valueset a friend More...
 

Detailed Description

template<typename T>
class WValueSet< T >::SubArray

A helper class granting safe access to a certain part of the valueset.

Definition at line 64 of file WValueSet.h.

Constructor & Destructor Documentation

◆ ~SubArray()

template<typename T >
WValueSet< T >::SubArray::~SubArray ( )
inline

Destructor.

Definition at line 73 of file WValueSet.h.

◆ SubArray()

template<typename T >
WValueSet< T >::SubArray::SubArray ( T const *const  p,
std::size_t  size 
)
inlineprivate

Construct an object that allows safe access.

(no access to elements not in the subarray's range). Only a valueset may construct a SubArray.

Parameters
pA pointer to the first element.
sizeThe size of the subarray.

Definition at line 101 of file WValueSet.h.

Member Function Documentation

◆ operator[]()

template<typename T >
T const& WValueSet< T >::SubArray::operator[] ( std::size_t  i) const
inline

Safe access.

Only the const version is allowed.

Parameters
iThe relative position of the element in the subarray's range.
Note
If i is not in ( 0, size - 1 ), the first element will be returned.
Returns
the value

Definition at line 86 of file WValueSet.h.

References WValueSet< T >::SubArray::m_ptr, and WValueSet< T >::SubArray::m_size.

Friends And Related Function Documentation

◆ WValueSet

template<typename T >
friend class WValueSet
friend

make the valueset a friend

Definition at line 68 of file WValueSet.h.

Member Data Documentation

◆ m_ptr

template<typename T >
T const* const WValueSet< T >::SubArray::m_ptr
private

the pointer to the first element

Definition at line 108 of file WValueSet.h.

Referenced by WValueSet< T >::SubArray::operator[]().

◆ m_size

template<typename T >
std::size_t const WValueSet< T >::SubArray::m_size
private

the size of the subarray

Definition at line 111 of file WValueSet.h.

Referenced by WValueSet< T >::SubArray::operator[]().


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