MeshLib Documentation
Loading...
Searching...
No Matches
MR::Buffer< V, I > Class Template Reference

std::vector<V>-like container that is 1) resized without initialization of its elements, 2) much simplified: no push_back and many other methods More...

#include <MRBuffer.h>

Public Types

using T = typename NoCtor<V>::type
 
using reference = T&
 
using const_reference = const T&
 
using iterator = T*
 
using const_iterator = const T*
 

Public Member Functions

 Buffer ()=default
 
 Buffer (size_t size)
 
auto capacity () const
 
auto size () const
 
bool empty () const
 
void clear ()
 
void resize (size_t newSize)
 
const_reference operator[] (I i) const
 
reference operator[] (I i)
 
auto data ()
 
auto data () const
 
I beginId () const
 returns the identifier of the first element
 
I backId () const
 returns the identifier of the back() element
 
I endId () const
 returns backId() + 1
 
size_t heapBytes () const
 returns the amount of memory this object occupies on heap
 

Detailed Description

template<typename V, typename I>
class MR::Buffer< V, I >

std::vector<V>-like container that is 1) resized without initialization of its elements, 2) much simplified: no push_back and many other methods

Template Parameters
Vtype of stored elements
Itype of index (shall be convertible to size_t)

Member Typedef Documentation

◆ const_iterator

template<typename V , typename I >
using MR::Buffer< V, I >::const_iterator = const T*

◆ const_reference

template<typename V , typename I >
using MR::Buffer< V, I >::const_reference = const T&

◆ iterator

template<typename V , typename I >
using MR::Buffer< V, I >::iterator = T*

◆ reference

template<typename V , typename I >
using MR::Buffer< V, I >::reference = T&

◆ T

template<typename V , typename I >
using MR::Buffer< V, I >::T = typename NoCtor<V>::type

Constructor & Destructor Documentation

◆ Buffer() [1/2]

template<typename V , typename I >
MR::Buffer< V, I >::Buffer ( )
default

◆ Buffer() [2/2]

template<typename V , typename I >
MR::Buffer< V, I >::Buffer ( size_t size)
inlineexplicit

Member Function Documentation

◆ backId()

template<typename V , typename I >
I MR::Buffer< V, I >::backId ( ) const
inlinenodiscard

returns the identifier of the back() element

◆ beginId()

template<typename V , typename I >
I MR::Buffer< V, I >::beginId ( ) const
inlinenodiscard

returns the identifier of the first element

◆ capacity()

template<typename V , typename I >
auto MR::Buffer< V, I >::capacity ( ) const
inlinenodiscard

◆ clear()

template<typename V , typename I >
void MR::Buffer< V, I >::clear ( )
inline

◆ data() [1/2]

template<typename V , typename I >
auto MR::Buffer< V, I >::data ( )
inlinenodiscard

◆ data() [2/2]

template<typename V , typename I >
auto MR::Buffer< V, I >::data ( ) const
inlinenodiscard

◆ empty()

template<typename V , typename I >
bool MR::Buffer< V, I >::empty ( ) const
inlinenodiscard

◆ endId()

template<typename V , typename I >
I MR::Buffer< V, I >::endId ( ) const
inlinenodiscard

returns backId() + 1

◆ heapBytes()

template<typename V , typename I >
size_t MR::Buffer< V, I >::heapBytes ( ) const
inlinenodiscard

returns the amount of memory this object occupies on heap

◆ operator[]() [1/2]

template<typename V , typename I >
reference MR::Buffer< V, I >::operator[] ( I i)
inlinenodiscard

◆ operator[]() [2/2]

template<typename V , typename I >
const_reference MR::Buffer< V, I >::operator[] ( I i) const
inlinenodiscard

◆ resize()

template<typename V , typename I >
void MR::Buffer< V, I >::resize ( size_t newSize)
inline

◆ size()

template<typename V , typename I >
auto MR::Buffer< V, I >::size ( ) const
inlinenodiscard

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