MeshLib C++ Docs
Loading...
Searching...
No Matches
MR::Vector< T, I > Class Template Reference

std::vector<T>-like container that requires specific indexing type, More...

#include <MRVector.h>

Public Types

using value_type = typename std::vector<T>::value_type
 
using reference = typename std::vector<T>::reference
 
using const_reference = typename std::vector<T>::const_reference
 
using iterator = typename std::vector<T>::iterator
 
using const_iterator = typename std::vector<T>::const_iterator
 

Public Member Functions

 Vector ()=default
 creates empty vector
 
 Vector (size_t size) MR_REQUIRES_IF_SUPPORTED(sizeof(T)>0 &&std
 creates a vector with size elements with default value
 
 Vector (size_t size, const T &val)
 creates a vector with size elements with the given value
 
 Vector (std::vector< T > &&vec)
 moves data from the given std::vector<T>
 
template<class InputIt >
 Vector (InputIt first, InputIt last)
 
 Vector (std::initializer_list< T > init)
 
bool operator== (const Vector &b) const MR_REQUIRES_IF_SUPPORTED(sizeof(T)>0 &&std
 
bool operator!= (const Vector &b) const MR_REQUIRES_IF_SUPPORTED(sizeof(T)>0 &&std
 
void clear ()
 
bool empty () const
 
std::size_t size () const
 
void resize (size_t newSize) MR_REQUIRES_IF_SUPPORTED(sizeof(T)>0 &&std
 
void resize (size_t newSize, const T &t) MR_REQUIRES_IF_SUPPORTED(sizeof(T)>0 &&std
 
void resizeNoInit (size_t targetSize) MR_REQUIRES_IF_SUPPORTED(sizeof(T)>0 &&std
 resizes the vector skipping initialization of its elements (more precisely initializing them using ( noInit ) constructor )
 
std::size_t capacity () const
 
void reserve (size_t capacity)
 
const_reference operator[] (I i) const MR_LIFETIMEBOUND
 
reference operator[] (I i) MR_LIFETIMEBOUND
 
void resizeWithReserve (size_t newSize) MR_REQUIRES_IF_SUPPORTED(sizeof(T)>0 &&std
 doubles reserved memory until resize(newSize) can be done without reallocation
 
void resizeWithReserve (size_t newSize, const T &value) MR_REQUIRES_IF_SUPPORTED(sizeof(T)>0 &&std
 doubles reserved memory until resize(newSize, value) can be done without reallocation
 
void autoResizeSet (I pos, size_t len, T val) MR_REQUIRES_IF_SUPPORTED(sizeof(T)>0 &&std
 
void autoResizeSet (I i, T val) MR_REQUIRES_IF_SUPPORTED(sizeof(T)>0 &&std
 sets the element #i to the given value, adjusting the size of the vector to include new element
 
reference autoResizeAt (I i) MR_REQUIRES_IF_SUPPORTED(sizeof(T)>0 &&std
 this accessor automatically adjusts the size of the vector
 
void push_back (const T &t MR_LIFETIME_CAPTURE_BY_NESTED(this))
 
void push_back (T &&t MR_LIFETIME_CAPTURE_BY_NESTED(this))
 
void pop_back ()
 
template<typename... Args>
 MR_REQUIRES_IF_SUPPORTED (sizeof(T)>0 &&std::constructible_from< T, Args &&... >) T &emplace_back(Args &&... args)
 
const_reference front () const MR_LIFETIMEBOUND
 
reference front () MR_LIFETIMEBOUND
 
const_reference back () const MR_LIFETIMEBOUND
 
reference back () MR_LIFETIMEBOUND
 
beginId () const
 returns the identifier of the first element
 
backId () const
 returns the identifier of the back() element
 
endId () const
 returns backId() + 1
 
T * data () MR_LIFETIMEBOUND
 
const T * data () const MR_LIFETIMEBOUND
 
void swap (Vector &b)
 
size_t heapBytes () const
 returns the amount of memory this object occupies on heap
 

Public Attributes

std::vector< T > vec_
 the user can directly manipulate the vector, anyway she cannot break anything
 

Detailed Description

template<typename T, typename I>
class MR::Vector< T, I >

std::vector<T>-like container that requires specific indexing type,

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

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