libGimbal 0.1.0
C17-Based Extended Standard Library and Cross-Language Runtime Framework
Loading...
Searching...
No Matches
gimbal::ReadWriteContiguousIndexable< CRTP, Index, Value > Class Template Reference
Inheritance diagram for gimbal::ReadWriteContiguousIndexable< CRTP, Index, Value >:
gimbal::ReadWriteIndexable< CRTP, Index, Value, true > gimbal::StringViewBase< String > gimbal::StringViewBase< StringView > gimbal::VectorViewBase< Vector< void * >, void * > gimbal::VectorViewBase< Vector< T >, T > gimbal::VectorViewBase< VectorView< T >, T > gimbal::String gimbal::StringView gimbal::Vector< T > gimbal::VectorView< T > gimbal::FlexibleString< ExtraStackSize > gimbal::FlexibleVector< ExtraStackSize, T >

Public Member Functions

void checkBounds (Index index) const
 
Index size (void) const
 
Index length (void) const
 
Index empty (void) const
 
Value at (Index index) const
 
IndexableProxy at (Index index)
 
Value front (Index index) const
 
IndexableProxy front (void)
 
Value back (void) const
 
IndexableProxy back (void)
 
- Public Member Functions inherited from gimbal::ReadWriteIndexable< CRTP, Index, Value, true >
Value operator[] (Index key) const
 

Detailed Description

template<typename CRTP, typename Index, typename Value>
class gimbal::ReadWriteContiguousIndexable< CRTP, Index, Value >

Definition at line 57 of file gimbal_generics.hpp.

Member Function Documentation

◆ checkBounds()

template<typename CRTP , typename Index , typename Value >
void gimbal::ReadWriteContiguousIndexable< CRTP, Index, Value >::checkBounds ( Index  index) const
inline

Definition at line 65 of file gimbal_generics.hpp.

65 {
66 if(index >= size()) Exception::checkThrow({Result::ErrorOutOfRange, "index > size"});
67 }

◆ size()

template<typename CRTP , typename Index , typename Value >
Index gimbal::ReadWriteContiguousIndexable< CRTP, Index, Value >::size ( void  ) const
inline

Definition at line 69 of file gimbal_generics.hpp.

69 {
70 return static_cast<const CRTP*>(this)->getElementCount_();
71 }

◆ length()

template<typename CRTP , typename Index , typename Value >
Index gimbal::ReadWriteContiguousIndexable< CRTP, Index, Value >::length ( void  ) const
inline

Definition at line 73 of file gimbal_generics.hpp.

73{ return size(); }

◆ empty()

template<typename CRTP , typename Index , typename Value >
Index gimbal::ReadWriteContiguousIndexable< CRTP, Index, Value >::empty ( void  ) const
inline

Definition at line 75 of file gimbal_generics.hpp.

75 {
76 return size() == 0;
77 }

◆ at() [1/2]

template<typename CRTP , typename Index , typename Value >
Value gimbal::ReadWriteContiguousIndexable< CRTP, Index, Value >::at ( Index  index) const
inline

Definition at line 79 of file gimbal_generics.hpp.

79 {
80 checkBounds(index);
81 return static_cast<const CRTP*>(this)->getElement_(index);
82 }

◆ at() [2/2]

template<typename CRTP , typename Index , typename Value >
IndexableProxy gimbal::ReadWriteContiguousIndexable< CRTP, Index, Value >::at ( Index  index)
inline

Definition at line 84 of file gimbal_generics.hpp.

84 {
85 checkBounds(index);
86 return IndexableProxy { static_cast<CRTP*>(this), index };
87 }

◆ front() [1/2]

template<typename CRTP , typename Index , typename Value >
Value gimbal::ReadWriteContiguousIndexable< CRTP, Index, Value >::front ( Index  index) const
inline

Definition at line 89 of file gimbal_generics.hpp.

89 {
90 return *this[index];
91 }

◆ front() [2/2]

template<typename CRTP , typename Index , typename Value >
IndexableProxy gimbal::ReadWriteContiguousIndexable< CRTP, Index, Value >::front ( void  )
inline

Definition at line 93 of file gimbal_generics.hpp.

93 {
94 return IndexableProxy { static_cast<CRTP*>(this), 0 };
95 }

◆ back() [1/2]

template<typename CRTP , typename Index , typename Value >
Value gimbal::ReadWriteContiguousIndexable< CRTP, Index, Value >::back ( void  ) const
inline

Definition at line 97 of file gimbal_generics.hpp.

97 {
98 return *this[size() - 1];
99 }

◆ back() [2/2]

template<typename CRTP , typename Index , typename Value >
IndexableProxy gimbal::ReadWriteContiguousIndexable< CRTP, Index, Value >::back ( void  )
inline

Definition at line 101 of file gimbal_generics.hpp.

101 {
102 return IndexableProxy { static_cast<CRTP*>(this), size() - 1 };
103 }

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