mn::container::basic_vector< T, TAllocator, TStorage > Class Template Reference

#include <mn_vector.hpp>

+ Inheritance diagram for mn::container::basic_vector< T, TAllocator, TStorage >:
+ Collaboration diagram for mn::container::basic_vector< T, TAllocator, TStorage >:

Public Types

using iterator_category = random_access_iterator_tag
 
using value_type = T
 
using pointer = T *
 
using reference = T &
 
using lreference = T &&
 
using const_reference = const T &
 
using difference_type = mn::ptrdiff_t
 
using iterator = pointer
 
using const_iterator = const pointer
 
using allocator_type = TAllocator
 
using size_type = mn::size_t
 

Public Member Functions

 basic_vector (const allocator_type &allocator=allocator_type())
 
 basic_vector (size_type initialSize, const allocator_type &allocator=allocator_type())
 
 basic_vector (const_iterator first, const_iterator last, const allocator_type &allocator=allocator_type())
 
 basic_vector (const basic_vector &rhs, const allocator_type &allocator=allocator_type())
 
 ~basic_vector ()
 
void copy (const basic_vector &rhs)
 
iterator begin ()
 
iterator end ()
 
size_type size () const
 
bool empty () const
 
size_type capacity ()
 
pointer data ()
 
reference front ()
 
const reference cfront ()
 
reference back ()
 
const reference cback ()
 
reference at (size_type i)
 
const reference const_at (size_type i)
 
void push_back (const_reference v)
 
void push_back (lreference v)
 
void push_back ()
 
void pop_back ()
 
void assign (const pointer first, const pointer last)
 
void insert (size_type index, size_type n, const reference val)
 
void insert (iterator it, size_type n, const reference val)
 
iterator insert (iterator it, const_reference val)
 
iterator erase (iterator it)
 
iterator erase (iterator first, iterator last)
 
void resize (size_type n)
 
void reserve (size_type n)
 
void clear ()
 
void reset ()
 
void set_capacity (size_type newCapacity)
 
size_type index_of (const reference item, size_type index=0) const
 
iterator find (const reference item)
 
const allocator_typeget_allocator () const
 
void set_allocator (const allocator_type &allocator)
 
bool validate_iterator (const_iterator it) const
 
basic_vectoroperator= (const basic_vector &rhs)
 
reference operator[] (size_type i)
 
const reference operator[] (size_type i) const
 

Static Public Attributes

static const size_type npos = size_type(-1)
 
static const size_type kInitialCapacity = 16
 

Private Member Functions

size_type compute_new_capacity (size_type newMinCapacity) const
 
void grow ()
 
void shrink (size_type newSize)
 
void move_down_1 (iterator it, int_to_type< true > itt)
 
void move_down_1 (iterator it, int_to_type< false > itt)
 
void move_down (iterator it_start, iterator it_result, int_to_type< true > itt)
 
void move_down (iterator it_start, iterator it_result, int_to_type< false > itt)
 
- Private Member Functions inherited from mn::container::basic_vector_storage< T, TAllocator >
 basic_vector_storage (const allocator_type &allocator)
 
void reallocate (size_type newCapacity, size_type oldSize)
 
void reallocate_discard_old (size_type newCapacity)
 
void destroy (pointer ptr, size_type n)
 
void reset ()
 
bool invariant () const
 
void swap (self_type &other)
 

Additional Inherited Members

- Private Types inherited from mn::container::basic_vector_storage< T, TAllocator >
using allocator_type = TAllocator
 
using self_type = basic_vector_storage< T, TAllocator >
 
using value_type = T
 
using pointer = value_type *
 
using reference = value_type &
 
using lreference = T &&
 
using size_type = mn::size_t
 
- Private Attributes inherited from mn::container::basic_vector_storage< T, TAllocator >
pointer m_begin
 
pointer m_end
 
pointer m_capacityEnd
 
allocator_type m_allocator
 

Member Typedef Documentation

◆ allocator_type

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
using mn::container::basic_vector< T, TAllocator, TStorage >::allocator_type = TAllocator

◆ const_iterator

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
using mn::container::basic_vector< T, TAllocator, TStorage >::const_iterator = const pointer

◆ const_reference

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
using mn::container::basic_vector< T, TAllocator, TStorage >::const_reference = const T&

◆ difference_type

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
using mn::container::basic_vector< T, TAllocator, TStorage >::difference_type = mn::ptrdiff_t

◆ iterator

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
using mn::container::basic_vector< T, TAllocator, TStorage >::iterator = pointer

◆ iterator_category

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
using mn::container::basic_vector< T, TAllocator, TStorage >::iterator_category = random_access_iterator_tag

◆ lreference

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
using mn::container::basic_vector< T, TAllocator, TStorage >::lreference = T&&

◆ pointer

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
using mn::container::basic_vector< T, TAllocator, TStorage >::pointer = T*

◆ reference

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
using mn::container::basic_vector< T, TAllocator, TStorage >::reference = T&

◆ size_type

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
using mn::container::basic_vector< T, TAllocator, TStorage >::size_type = mn::size_t

◆ value_type

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
using mn::container::basic_vector< T, TAllocator, TStorage >::value_type = T

Constructor & Destructor Documentation

◆ basic_vector() [1/4]

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
mn::container::basic_vector< T, TAllocator, TStorage >::basic_vector ( const allocator_type allocator = allocator_type())
inlineexplicit

◆ basic_vector() [2/4]

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
mn::container::basic_vector< T, TAllocator, TStorage >::basic_vector ( size_type  initialSize,
const allocator_type allocator = allocator_type() 
)
inlineexplicit

◆ basic_vector() [3/4]

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
mn::container::basic_vector< T, TAllocator, TStorage >::basic_vector ( const_iterator  first,
const_iterator  last,
const allocator_type allocator = allocator_type() 
)
inline

◆ basic_vector() [4/4]

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
mn::container::basic_vector< T, TAllocator, TStorage >::basic_vector ( const basic_vector< T, TAllocator, TStorage > &  rhs,
const allocator_type allocator = allocator_type() 
)
inline

◆ ~basic_vector()

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
mn::container::basic_vector< T, TAllocator, TStorage >::~basic_vector ( )
inline

Member Function Documentation

◆ assign()

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
void mn::container::basic_vector< T, TAllocator, TStorage >::assign ( const pointer  first,
const pointer  last 
)
inline

◆ at()

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
reference mn::container::basic_vector< T, TAllocator, TStorage >::at ( size_type  i)
inline

◆ back()

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
reference mn::container::basic_vector< T, TAllocator, TStorage >::back ( )
inline

◆ begin()

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
iterator mn::container::basic_vector< T, TAllocator, TStorage >::begin ( )
inline

◆ capacity()

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
size_type mn::container::basic_vector< T, TAllocator, TStorage >::capacity ( )
inline

◆ cback()

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
const reference mn::container::basic_vector< T, TAllocator, TStorage >::cback ( )
inline

◆ cfront()

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
const reference mn::container::basic_vector< T, TAllocator, TStorage >::cfront ( )
inline

◆ clear()

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
void mn::container::basic_vector< T, TAllocator, TStorage >::clear ( )
inline

◆ compute_new_capacity()

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
size_type mn::container::basic_vector< T, TAllocator, TStorage >::compute_new_capacity ( size_type  newMinCapacity) const
inlineprivate

◆ const_at()

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
const reference mn::container::basic_vector< T, TAllocator, TStorage >::const_at ( size_type  i)
inline

◆ copy()

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
void mn::container::basic_vector< T, TAllocator, TStorage >::copy ( const basic_vector< T, TAllocator, TStorage > &  rhs)
inline

◆ data()

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
pointer mn::container::basic_vector< T, TAllocator, TStorage >::data ( )
inline

◆ empty()

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
bool mn::container::basic_vector< T, TAllocator, TStorage >::empty ( void  ) const
inline

◆ end()

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
iterator mn::container::basic_vector< T, TAllocator, TStorage >::end ( )
inline

◆ erase() [1/2]

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
iterator mn::container::basic_vector< T, TAllocator, TStorage >::erase ( iterator  first,
iterator  last 
)
inline

◆ erase() [2/2]

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
iterator mn::container::basic_vector< T, TAllocator, TStorage >::erase ( iterator  it)
inline

◆ find()

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
iterator mn::container::basic_vector< T, TAllocator, TStorage >::find ( const reference  item)
inline

◆ front()

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
reference mn::container::basic_vector< T, TAllocator, TStorage >::front ( )
inline

◆ get_allocator()

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
const allocator_type& mn::container::basic_vector< T, TAllocator, TStorage >::get_allocator ( ) const
inline

◆ grow()

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
void mn::container::basic_vector< T, TAllocator, TStorage >::grow ( )
inlineprivate

◆ index_of()

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
size_type mn::container::basic_vector< T, TAllocator, TStorage >::index_of ( const reference  item,
size_type  index = 0 
) const
inline

◆ insert() [1/3]

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
iterator mn::container::basic_vector< T, TAllocator, TStorage >::insert ( iterator  it,
const_reference  val 
)
inline

◆ insert() [2/3]

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
void mn::container::basic_vector< T, TAllocator, TStorage >::insert ( iterator  it,
size_type  n,
const reference  val 
)
inline

◆ insert() [3/3]

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
void mn::container::basic_vector< T, TAllocator, TStorage >::insert ( size_type  index,
size_type  n,
const reference  val 
)
inline

◆ move_down() [1/2]

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
void mn::container::basic_vector< T, TAllocator, TStorage >::move_down ( iterator  it_start,
iterator  it_result,
int_to_type< false >  itt 
)
inlineprivate

◆ move_down() [2/2]

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
void mn::container::basic_vector< T, TAllocator, TStorage >::move_down ( iterator  it_start,
iterator  it_result,
int_to_type< true >  itt 
)
inlineprivate

◆ move_down_1() [1/2]

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
void mn::container::basic_vector< T, TAllocator, TStorage >::move_down_1 ( iterator  it,
int_to_type< false >  itt 
)
inlineprivate

◆ move_down_1() [2/2]

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
void mn::container::basic_vector< T, TAllocator, TStorage >::move_down_1 ( iterator  it,
int_to_type< true >  itt 
)
inlineprivate

◆ operator=()

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
basic_vector& mn::container::basic_vector< T, TAllocator, TStorage >::operator= ( const basic_vector< T, TAllocator, TStorage > &  rhs)
inline

◆ operator[]() [1/2]

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
reference mn::container::basic_vector< T, TAllocator, TStorage >::operator[] ( size_type  i)
inline

◆ operator[]() [2/2]

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
const reference mn::container::basic_vector< T, TAllocator, TStorage >::operator[] ( size_type  i) const
inline

◆ pop_back()

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
void mn::container::basic_vector< T, TAllocator, TStorage >::pop_back ( )
inline

◆ push_back() [1/3]

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
void mn::container::basic_vector< T, TAllocator, TStorage >::push_back ( )
inline

◆ push_back() [2/3]

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
void mn::container::basic_vector< T, TAllocator, TStorage >::push_back ( const_reference  v)
inline

◆ push_back() [3/3]

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
void mn::container::basic_vector< T, TAllocator, TStorage >::push_back ( lreference  v)
inline

◆ reserve()

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
void mn::container::basic_vector< T, TAllocator, TStorage >::reserve ( size_type  n)
inline

◆ reset()

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
void mn::container::basic_vector< T, TAllocator, TStorage >::reset ( )
inline

◆ resize()

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
void mn::container::basic_vector< T, TAllocator, TStorage >::resize ( size_type  n)
inline

◆ set_allocator()

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
void mn::container::basic_vector< T, TAllocator, TStorage >::set_allocator ( const allocator_type allocator)
inline

◆ set_capacity()

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
void mn::container::basic_vector< T, TAllocator, TStorage >::set_capacity ( size_type  newCapacity)
inline

◆ shrink()

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
void mn::container::basic_vector< T, TAllocator, TStorage >::shrink ( size_type  newSize)
inlineprivate

◆ size()

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
size_type mn::container::basic_vector< T, TAllocator, TStorage >::size ( ) const
inline

◆ validate_iterator()

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
bool mn::container::basic_vector< T, TAllocator, TStorage >::validate_iterator ( const_iterator  it) const
inline

Member Data Documentation

◆ kInitialCapacity

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
const size_type mn::container::basic_vector< T, TAllocator, TStorage >::kInitialCapacity = 16
static

◆ npos

template<typename T , class TAllocator , class TStorage = basic_vector_storage<T, TAllocator>>
const size_type mn::container::basic_vector< T, TAllocator, TStorage >::npos = size_type(-1)
static

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