MRPT  2.0.4
List of all members | Classes | Public Types | Public Member Functions | Private Types
mrpt::containers::vector_with_small_size_optimization< VAL, small_size, alignment > Class Template Reference

Detailed Description

template<typename VAL, size_t small_size, size_t alignment = 16>
class mrpt::containers::vector_with_small_size_optimization< VAL, small_size, alignment >

Container that transparently and dynamically switches between a std::array and std::vector.

Used to avoid heap allocations with small vectors.

Note
In #include <mrpt/containers/vector_with_small_size_optimization.h>

Definition at line 37 of file vector_with_small_size_optimization.h.

#include <mrpt/containers/vector_with_small_size_optimization.h>

Inheritance diagram for mrpt::containers::vector_with_small_size_optimization< VAL, small_size, alignment >:

Classes

class  iteratorImpl
 

Public Types

using value_type = T
 
using reference = T &
 
using const_reference = const T &
 
using difference_type = typename large_vec::difference_type
 
using size_type = typename large_vec::size_type
 
using iterator = iteratorImpl< VAL, VAL *, VAL & >
 
using const_iterator = iteratorImpl< VAL, const VAL *, const VAL & >
 

Public Member Functions

 vector_with_small_size_optimization ()=default
 
 ~vector_with_small_size_optimization ()=default
 
 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)
 
vector_with_small_size_optimizationoperator= (const vector_with_small_size_optimization &o)
 
vector_with_small_size_optimizationoperator= (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
 
const_reference back () const
 
reference back ()
 
const_reference front () const
 
reference front ()
 
void swap (self_t &x)
 
iterator begin () noexcept
 
const_iterator begin () const noexcept
 
iterator end () noexcept
 
const_iterator end () const noexcept
 

Private Types

using T = std::conditional_t< std::is_same_v< VAL, bool >, internal::UnspecializedBool, VAL >
 
using ALLOC = mrpt::aligned_allocator_cpp11< T >
 
using self_t = vector_with_small_size_optimization< VAL, small_size, alignment >
 
using large_vec = std::vector< T, ALLOC >
 
using small_array = std::array< T, small_size >
 

Private Attributes

Data
large_vec m_v
 
small_array m_a
 
bool m_is_small = true
 
size_t m_size = 0
 

Member Typedef Documentation

◆ ALLOC

template<typename VAL, size_t small_size, size_t alignment = 16>
using mrpt::containers::vector_with_small_size_optimization< VAL, small_size, alignment >::ALLOC = mrpt::aligned_allocator_cpp11<T>
private

Definition at line 42 of file vector_with_small_size_optimization.h.

◆ const_iterator

template<typename VAL, size_t small_size, size_t alignment = 16>
using mrpt::containers::vector_with_small_size_optimization< VAL, small_size, alignment >::const_iterator = iteratorImpl<VAL, const VAL*, const VAL&>

Definition at line 182 of file vector_with_small_size_optimization.h.

◆ const_reference

template<typename VAL, size_t small_size, size_t alignment = 16>
using mrpt::containers::vector_with_small_size_optimization< VAL, small_size, alignment >::const_reference = const T&

Definition at line 59 of file vector_with_small_size_optimization.h.

◆ difference_type

template<typename VAL, size_t small_size, size_t alignment = 16>
using mrpt::containers::vector_with_small_size_optimization< VAL, small_size, alignment >::difference_type = typename large_vec::difference_type

Definition at line 60 of file vector_with_small_size_optimization.h.

◆ iterator

template<typename VAL, size_t small_size, size_t alignment = 16>
using mrpt::containers::vector_with_small_size_optimization< VAL, small_size, alignment >::iterator = iteratorImpl<VAL, VAL*, VAL&>

Definition at line 181 of file vector_with_small_size_optimization.h.

◆ large_vec

template<typename VAL, size_t small_size, size_t alignment = 16>
using mrpt::containers::vector_with_small_size_optimization< VAL, small_size, alignment >::large_vec = std::vector<T, ALLOC>
private

Definition at line 45 of file vector_with_small_size_optimization.h.

◆ reference

template<typename VAL, size_t small_size, size_t alignment = 16>
using mrpt::containers::vector_with_small_size_optimization< VAL, small_size, alignment >::reference = T&

Definition at line 58 of file vector_with_small_size_optimization.h.

◆ self_t

template<typename VAL, size_t small_size, size_t alignment = 16>
using mrpt::containers::vector_with_small_size_optimization< VAL, small_size, alignment >::self_t = vector_with_small_size_optimization<VAL, small_size, alignment>
private

Definition at line 44 of file vector_with_small_size_optimization.h.

◆ size_type

template<typename VAL, size_t small_size, size_t alignment = 16>
using mrpt::containers::vector_with_small_size_optimization< VAL, small_size, alignment >::size_type = typename large_vec::size_type

Definition at line 61 of file vector_with_small_size_optimization.h.

◆ small_array

template<typename VAL, size_t small_size, size_t alignment = 16>
using mrpt::containers::vector_with_small_size_optimization< VAL, small_size, alignment >::small_array = std::array<T, small_size>
private

Definition at line 46 of file vector_with_small_size_optimization.h.

◆ T

template<typename VAL, size_t small_size, size_t alignment = 16>
using mrpt::containers::vector_with_small_size_optimization< VAL, small_size, alignment >::T = std::conditional_t< std::is_same_v<VAL, bool>, internal::UnspecializedBool, VAL>
private

Definition at line 41 of file vector_with_small_size_optimization.h.

◆ value_type

template<typename VAL, size_t small_size, size_t alignment = 16>
using mrpt::containers::vector_with_small_size_optimization< VAL, small_size, alignment >::value_type = T

Definition at line 57 of file vector_with_small_size_optimization.h.

Constructor & Destructor Documentation

◆ vector_with_small_size_optimization() [1/4]

template<typename VAL, size_t small_size, size_t alignment = 16>
mrpt::containers::vector_with_small_size_optimization< VAL, small_size, alignment >::vector_with_small_size_optimization ( )
default

◆ ~vector_with_small_size_optimization()

template<typename VAL, size_t small_size, size_t alignment = 16>
mrpt::containers::vector_with_small_size_optimization< VAL, small_size, alignment >::~vector_with_small_size_optimization ( )
default

◆ vector_with_small_size_optimization() [2/4]

template<typename VAL, size_t small_size, size_t alignment = 16>
mrpt::containers::vector_with_small_size_optimization< VAL, small_size, alignment >::vector_with_small_size_optimization ( size_t  n)
inline

Definition at line 66 of file vector_with_small_size_optimization.h.

◆ vector_with_small_size_optimization() [3/4]

template<typename VAL, size_t small_size, size_t alignment = 16>
mrpt::containers::vector_with_small_size_optimization< VAL, small_size, alignment >::vector_with_small_size_optimization ( const vector_with_small_size_optimization< VAL, small_size, alignment > &  o)
inline

Definition at line 72 of file vector_with_small_size_optimization.h.

◆ vector_with_small_size_optimization() [4/4]

template<typename VAL, size_t small_size, size_t alignment = 16>
mrpt::containers::vector_with_small_size_optimization< VAL, small_size, alignment >::vector_with_small_size_optimization ( vector_with_small_size_optimization< VAL, small_size, alignment > &&  o)
inline

Definition at line 77 of file vector_with_small_size_optimization.h.

Member Function Documentation

◆ back() [1/2]

template<typename VAL, size_t small_size, size_t alignment = 16>
const_reference mrpt::containers::vector_with_small_size_optimization< VAL, small_size, alignment >::back ( ) const
inline

Definition at line 223 of file vector_with_small_size_optimization.h.

Referenced by mrpt::math::CVectorDynamic< KFTYPE >::push_back(), and TEST().

Here is the caller graph for this function:

◆ back() [2/2]

template<typename VAL, size_t small_size, size_t alignment = 16>
reference mrpt::containers::vector_with_small_size_optimization< VAL, small_size, alignment >::back ( )
inline

Definition at line 227 of file vector_with_small_size_optimization.h.

◆ begin() [1/2]

template<typename VAL, size_t small_size, size_t alignment = 16>
iterator mrpt::containers::vector_with_small_size_optimization< VAL, small_size, alignment >::begin ( )
inlinenoexcept

Definition at line 259 of file vector_with_small_size_optimization.h.

Referenced by mrpt::math::CVectorDynamic< KFTYPE >::begin(), mrpt::math::CMatrixDynamic< mrpt::math::TPoint3D_data< double > >::begin(), mrpt::math::CVectorDynamic< KFTYPE >::cbegin(), and mrpt::math::CMatrixDynamic< mrpt::math::TPoint3D_data< double > >::cbegin().

Here is the caller graph for this function:

◆ begin() [2/2]

template<typename VAL, size_t small_size, size_t alignment = 16>
const_iterator mrpt::containers::vector_with_small_size_optimization< VAL, small_size, alignment >::begin ( ) const
inlinenoexcept

Definition at line 260 of file vector_with_small_size_optimization.h.

◆ empty()

template<typename VAL, size_t small_size, size_t alignment = 16>
bool mrpt::containers::vector_with_small_size_optimization< VAL, small_size, alignment >::empty ( ) const
inline

Definition at line 214 of file vector_with_small_size_optimization.h.

Referenced by mrpt::math::CMatrixDynamic< mrpt::math::TPoint3D_data< double > >::data(), mrpt::math::CVectorDynamic< KFTYPE >::empty(), and TEST().

Here is the caller graph for this function:

◆ end() [1/2]

template<typename VAL, size_t small_size, size_t alignment = 16>
iterator mrpt::containers::vector_with_small_size_optimization< VAL, small_size, alignment >::end ( )
inlinenoexcept

Definition at line 265 of file vector_with_small_size_optimization.h.

Referenced by mrpt::math::CVectorDynamic< KFTYPE >::cend(), mrpt::math::CMatrixDynamic< mrpt::math::TPoint3D_data< double > >::cend(), mrpt::math::CVectorDynamic< KFTYPE >::end(), and mrpt::math::CMatrixDynamic< mrpt::math::TPoint3D_data< double > >::end().

Here is the caller graph for this function:

◆ end() [2/2]

template<typename VAL, size_t small_size, size_t alignment = 16>
const_iterator mrpt::containers::vector_with_small_size_optimization< VAL, small_size, alignment >::end ( ) const
inlinenoexcept

Definition at line 269 of file vector_with_small_size_optimization.h.

◆ fill()

template<typename VAL, size_t small_size, size_t alignment = 16>
void mrpt::containers::vector_with_small_size_optimization< VAL, small_size, alignment >::fill ( const T v)
inline

Definition at line 205 of file vector_with_small_size_optimization.h.

◆ front() [1/2]

template<typename VAL, size_t small_size, size_t alignment = 16>
const_reference mrpt::containers::vector_with_small_size_optimization< VAL, small_size, alignment >::front ( ) const
inline

Definition at line 229 of file vector_with_small_size_optimization.h.

Referenced by TEST().

Here is the caller graph for this function:

◆ front() [2/2]

template<typename VAL, size_t small_size, size_t alignment = 16>
reference mrpt::containers::vector_with_small_size_optimization< VAL, small_size, alignment >::front ( )
inline

Definition at line 233 of file vector_with_small_size_optimization.h.

◆ operator=() [1/2]

template<typename VAL, size_t small_size, size_t alignment = 16>
vector_with_small_size_optimization& mrpt::containers::vector_with_small_size_optimization< VAL, small_size, alignment >::operator= ( const vector_with_small_size_optimization< VAL, small_size, alignment > &  o)
inline

Definition at line 81 of file vector_with_small_size_optimization.h.

◆ operator=() [2/2]

template<typename VAL, size_t small_size, size_t alignment = 16>
vector_with_small_size_optimization& mrpt::containers::vector_with_small_size_optimization< VAL, small_size, alignment >::operator= ( vector_with_small_size_optimization< VAL, small_size, alignment > &&  o)
inline

Definition at line 92 of file vector_with_small_size_optimization.h.

◆ operator[]() [1/2]

template<typename VAL, size_t small_size, size_t alignment = 16>
reference mrpt::containers::vector_with_small_size_optimization< VAL, small_size, alignment >::operator[] ( size_type  n)
inline

Definition at line 216 of file vector_with_small_size_optimization.h.

◆ operator[]() [2/2]

template<typename VAL, size_t small_size, size_t alignment = 16>
const_reference mrpt::containers::vector_with_small_size_optimization< VAL, small_size, alignment >::operator[] ( size_type  n) const
inline

Definition at line 218 of file vector_with_small_size_optimization.h.

◆ resize()

template<typename VAL, size_t small_size, size_t alignment = 16>
void mrpt::containers::vector_with_small_size_optimization< VAL, small_size, alignment >::resize ( size_type  n)
inline

Definition at line 184 of file vector_with_small_size_optimization.h.

Referenced by mrpt::math::CVectorDynamic< KFTYPE >::push_back(), mrpt::math::CVectorDynamic< KFTYPE >::realloc(), and TEST().

Here is the caller graph for this function:

◆ size()

template<typename VAL, size_t small_size, size_t alignment = 16>
size_t mrpt::containers::vector_with_small_size_optimization< VAL, small_size, alignment >::size ( ) const
inline

◆ swap()

template<typename VAL, size_t small_size, size_t alignment = 16>
void mrpt::containers::vector_with_small_size_optimization< VAL, small_size, alignment >::swap ( self_t x)
inline

Definition at line 235 of file vector_with_small_size_optimization.h.

Referenced by mrpt::math::CMatrixDynamic< mrpt::math::TPoint3D_data< double > >::realloc(), mrpt::math::CVectorDynamic< KFTYPE >::swap(), and mrpt::math::CMatrixDynamic< mrpt::math::TPoint3D_data< double > >::swap().

Here is the caller graph for this function:

Member Data Documentation

◆ m_a

template<typename VAL, size_t small_size, size_t alignment = 16>
small_array mrpt::containers::vector_with_small_size_optimization< VAL, small_size, alignment >::m_a
private

◆ m_is_small

template<typename VAL, size_t small_size, size_t alignment = 16>
bool mrpt::containers::vector_with_small_size_optimization< VAL, small_size, alignment >::m_is_small = true
private

◆ m_size

template<typename VAL, size_t small_size, size_t alignment = 16>
size_t mrpt::containers::vector_with_small_size_optimization< VAL, small_size, alignment >::m_size = 0
private

◆ m_v

template<typename VAL, size_t small_size, size_t alignment = 16>
large_vec mrpt::containers::vector_with_small_size_optimization< VAL, small_size, alignment >::m_v
private



Page generated by Doxygen 1.8.14 for MRPT 2.0.4 Git: 33de1d0ad Sat Jun 20 11:02:42 2020 +0200 at sáb jun 20 17:35:17 CEST 2020