template class mrpt::containers::vector_with_small_size_optimization
Overview
Container that transparently and dynamically switches between a std::array and std::vector.
Used to avoid heap allocations with small vectors.
In #include <mrpt/containers/vector_with_small_size_optimization.h>
#include <mrpt/containers/vector_with_small_size_optimization.h> template <typename VAL, size_t small_size, size_t alignment = 16> class vector_with_small_size_optimization { public: // typedefs typedef T value_type; typedef T& reference; typedef const T& const_reference; typedef typename large_vec::difference_type difference_type; typedef typename large_vec::size_type size_type; typedef iteratorImpl<VAL, VAL*, VAL&> iterator; typedef iteratorImpl<VAL, const VAL*, const VAL&> const_iterator; // classes template <typename TYPE, typename POINTER, typename REFERENCE> class iteratorImpl; // construction vector_with_small_size_optimization(); vector_with_small_size_optimization(size_t n); vector_with_small_size_optimization(const vector_with_small_size_optimization& o); vector_with_small_size_optimization(vector_with_small_size_optimization&& o); // methods vector_with_small_size_optimization& operator = (const vector_with_small_size_optimization& o); vector_with_small_size_optimization& operator = (vector_with_small_size_optimization&& o); void resize(size_type n); void fill(const T& v); size_t size() const; bool empty() const; reference operator [] (size_type n); const_reference operator [] (size_type n) const; reference at(size_type n); const_reference at(size_type n) const; const_reference back() const; reference back(); const_reference front() const; reference front(); void swap(self_t& x); iterator begin(); const_iterator begin() const; iterator end(); const_iterator end() const; void push_back(const VAL& val); };
Methods
reference at(size_type n)
Like [], but throws an exception if accessing out of bounds.
(Note in MRPT 2.3.3)
const_reference at(size_type n) const
Like [], but throws an exception if accessing out of bounds.
(Note in MRPT 2.3.3)
void push_back(const VAL& val)
Grows the container by one and writes the value in the new final position.
(Note in MRPT 2.3.3)