libGimbal 0.1.0
C17-Based Extended Standard Library and Cross-Language Runtime Framework
Loading...
Searching...
No Matches
gbl::ReadWriteContiguousIndexable< CRTP, Index, Value, Writable > Class Template Reference
Inheritance diagram for gbl::ReadWriteContiguousIndexable< CRTP, Index, Value, Writable >:
gbl::ReadWriteIndexable< CRTP, Index, Value, Writable > gbl::VectorViewBase< Vector< void * >, void * > gbl::VectorViewBase< Vector< T >, T > gbl::VectorViewBase< VectorView< T >, T > gbl::Vector< T > gbl::VectorView< T > gbl::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 gbl::ReadWriteIndexable< CRTP, Index, Value, Writable >
Value operator[] (Index key) const
 

Detailed Description

template<typename CRTP, typename Index, typename Value, bool Writable>
class gbl::ReadWriteContiguousIndexable< CRTP, Index, Value, Writable >

Definition at line 55 of file gimbal_generics.hpp.

Member Function Documentation

◆ checkBounds()

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

Definition at line 63 of file gimbal_generics.hpp.

63 {
64 if(index >= size()) throw std::out_of_range{"index > size"};
65 }

◆ size()

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

Definition at line 67 of file gimbal_generics.hpp.

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

◆ length()

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

Definition at line 71 of file gimbal_generics.hpp.

71{ return size(); }

◆ empty()

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

Definition at line 73 of file gimbal_generics.hpp.

73 {
74 return size() == 0;
75 }

◆ at() [1/2]

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

Definition at line 77 of file gimbal_generics.hpp.

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

◆ at() [2/2]

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

Definition at line 82 of file gimbal_generics.hpp.

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

◆ front() [1/2]

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

Definition at line 87 of file gimbal_generics.hpp.

87 {
88 return *this[index];
89 }

◆ front() [2/2]

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

Definition at line 91 of file gimbal_generics.hpp.

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

◆ back() [1/2]

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

Definition at line 95 of file gimbal_generics.hpp.

95 {
96 return *this[size() - 1];
97 }

◆ back() [2/2]

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

Definition at line 99 of file gimbal_generics.hpp.

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

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