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 |
std::size_t | capacity () const |
void | reserve (size_t capacity) |
const_reference | operator[] (I i) const |
reference | operator[] (I i) |
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) |
void | push_back (T &&t) |
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 |
reference | front () |
const_reference | back () const |
reference | back () |
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 | |
T * | data () |
const T * | data () const |
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 | |
std::vector<T>-like container that requires specific indexing type,
T | type of stored elements |
I | type of index (shall be convertible to size_t) |
using MR::Vector< T, I >::const_iterator = typename std::vector<T>::const_iterator |
using MR::Vector< T, I >::const_reference = typename std::vector<T>::const_reference |
using MR::Vector< T, I >::iterator = typename std::vector<T>::iterator |
using MR::Vector< T, I >::reference = typename std::vector<T>::reference |
using MR::Vector< T, I >::value_type = typename std::vector<T>::value_type |
|
default |
creates empty vector
|
inlineexplicit |
creates a vector with size
elements with default value
|
inlineexplicit |
creates a vector with size
elements with the given value
|
inline |
moves data from the given std::vector<T>
|
inline |
|
inline |
|
inlinenodiscard |
this accessor automatically adjusts the size of the vector
|
inline |
sets the element #i to the given value, adjusting the size of the vector to include new element
|
inline |
sets elements [pos, pos+len) to the given value, adjusting the size of the vector to include new elements; the elements in between old size and pos
are also set to val
(for faster implementation)
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
returns the identifier of the back() element
|
inlinenodiscard |
returns the identifier of the first element
|
inlinenodiscard |
|
inline |
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
returns backId() + 1
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
returns the amount of memory this object occupies on heap
|
inline |
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
doubles reserved memory until resize(newSize) can be done without reallocation
|
inline |
doubles reserved memory until resize(newSize, value) can be done without reallocation
|
inlinenodiscard |
|
inline |
std::vector<T> MR::Vector< T, I >::vec_ |
the user can directly manipulate the vector, anyway she cannot break anything