MeshLib C++ Docs
Loading...
Searching...
No Matches

Vector<T> is indexed by size_t. More...

#include <MRMesh/MRVector.h>

Public Types

using StdVector = std::vector<T, Allocator<T>>
using value_type = typename StdVector::value_type
using reference = typename StdVector::reference
using const_reference = typename StdVector::const_reference
using size_type = typename StdVector::size_type
using difference_type = typename StdVector::difference_type
using iterator = typename StdVector::iterator
using const_iterator = typename StdVector::const_iterator
using reverse_iterator = typename StdVector::reverse_iterator
using const_reverse_iterator = typename StdVector::const_reverse_iterator
using pointer = typename StdVector::pointer
using const_pointer = typename StdVector::const_pointer

Public Member Functions

 Vector ()=default
 creates empty vector
 Vector (size_t size)
 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
template<class InputIt>
 Vector (InputIt first, InputIt last)
 Vector (std::initializer_list< T > init)
void assign (size_t count, const T &val MR_LIFETIME_CAPTURE_BY_NESTED(this))
 replaces the contents with count copies of val
template<class InputIt>
void assign (InputIt first, InputIt last)
 replaces the contents with elements from range [first, last)
void assign (std::initializer_list< T > init)
bool operator== (const Vector &b) const
bool operator!= (const Vector &b) const
void clear ()
bool empty () const
std::size_t size () const
std::size_t max_size () const
void resize (size_t newSize)
void resize (size_t newSize, const T &t)
void resizeNoInit (size_t targetSize, ReserveMode mode=ReserveMode::Exact)
 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)
void shrink_to_fit ()
const_reference operator[] (I i) const
reference operator[] (I i)
void resizeWithReserve (size_t newSize)
 same as resize(newSize), which already grows the capacity geometrically
void resizeWithReserve (size_t newSize, const T &value)
 same as resize(newSize, value), which already grows the capacity geometrically
void autoResizeSet (I pos, size_t len, T val)
void autoResizeSet (I i, T val)
 sets the element i to the given value, adjusting the size of the vector to include new element
reference autoResizeAt (I i)
 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 ()
iterator insert (const_iterator pos, const T &t MR_LIFETIME_CAPTURE_BY_NESTED(this))
 inserts t before pos
iterator insert (const_iterator pos, T &&t MR_LIFETIME_CAPTURE_BY_NESTED(this))
iterator insert (const_iterator pos, size_t count, const T &t MR_LIFETIME_CAPTURE_BY_NESTED(this))
 inserts count copies of t before pos
template<class InputIt>
iterator insert (const_iterator pos, InputIt first, InputIt last)
 inserts elements from range [first, last) before pos
iterator insert (const_iterator pos, std::initializer_list< T > init)
template<typename... Args>
iterator emplace (const_iterator pos, Args &&... args)
 constructs an element in-place before pos
iterator erase (const_iterator pos)
 removes the element at pos
iterator erase (const_iterator first, const_iterator last)
 removes the elements in range [first, last)
template<typename... 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
iterator begin ()
const_iterator begin () const
const_iterator cbegin () const
iterator end ()
const_iterator end () const
const_iterator cend () const
reverse_iterator rbegin ()
const_reverse_iterator rbegin () const
const_reverse_iterator crbegin () const
reverse_iterator rend ()
const_reverse_iterator rend () const
const_reverse_iterator crend () const
void swap (Vector &b)
size_t heapBytes () const
 returns the amount of memory this object occupies on heap

Public Attributes

StdVector vec
 The user can directly manipulate the vector, they can't break anything anyway.

Friends

const_iterator begin (const Vector< T, I > &a)
iterator begin (Vector< T, I > &a)
const_iterator end (const Vector< T, I > &a)
iterator end (Vector< T, I > &a)
template<typename U>
size_t erase (Vector< T, I > &a, const U &value)
 removes all elements equal to value, returns the number of removed elements
template<typename Pred>
size_t erase_if (Vector< T, I > &a, Pred pred)
 removes all elements satisfying pred, returns the number of removed elements

Detailed Description

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

Vector<T> is indexed by size_t.

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 files: