Nugget
Public Types | Public Member Functions | Protected Attributes | List of all members
eastl::vector_map< Key, T, Compare, Allocator, RandomAccessContainer > Class Template Reference

#include <vector_map.h>

Inheritance diagram for eastl::vector_map< Key, T, Compare, Allocator, RandomAccessContainer >:
Inheritance graph
[legend]
Collaboration diagram for eastl::vector_map< Key, T, Compare, Allocator, RandomAccessContainer >:
Collaboration graph
[legend]

Public Types

typedef RandomAccessContainer base_type
 
typedef vector_map< Key, T, Compare, Allocator, RandomAccessContainer > this_type
 
typedef Allocator allocator_type
 
typedef Key key_type
 
typedef T mapped_type
 
typedef eastl::pair< Key, T > value_type
 
typedef Compare key_compare
 
typedef map_value_compare< Key, value_type, Compare > value_compare
 
typedef value_typepointer
 
typedef const value_typeconst_pointer
 
typedef value_typereference
 
typedef const value_typeconst_reference
 
typedef base_type::size_type size_type
 
typedef base_type::difference_type difference_type
 
typedef base_type::iterator iterator
 
typedef base_type::const_iterator const_iterator
 
typedef base_type::reverse_iterator reverse_iterator
 
typedef base_type::const_reverse_iterator const_reverse_iterator
 
typedef eastl::pair< iterator, bool > insert_return_type
 
- Public Types inherited from eastl::vector< eastl::pair< Key, T >, EASTLAllocatorType >
typedef eastl::pair< Key, T > value_type
 
typedef eastl::pair< Key, T > * pointer
 
typedef const eastl::pair< Key, T > * const_pointer
 
typedef eastl::pair< Key, T > & reference
 
typedef const eastl::pair< Key, T > & const_reference
 
typedef eastl::pair< Key, T > * iterator
 
typedef const eastl::pair< Key, T > * const_iterator
 
typedef eastl::reverse_iterator< iteratorreverse_iterator
 
typedef eastl::reverse_iterator< const_iteratorconst_reverse_iterator
 
typedef base_type::size_type size_type
 
typedef base_type::difference_type difference_type
 
typedef base_type::allocator_type allocator_type
 
- Public Types inherited from eastl::VectorBase< eastl::pair< Key, T >, EASTLAllocatorType >
typedef EASTLAllocatorType allocator_type
 
typedef eastl_size_t size_type
 
typedef ptrdiff_t difference_type
 

Public Member Functions

 vector_map (const allocator_type &allocator)
 
 vector_map (const key_compare &comp, const allocator_type &allocator=EASTL_VECTOR_MAP_DEFAULT_ALLOCATOR)
 
 vector_map (const this_type &x)
 
 vector_map (this_type &&x)
 
 vector_map (this_type &&x, const allocator_type &allocator)
 
 vector_map (std::initializer_list< value_type > ilist, const key_compare &compare=key_compare(), const allocator_type &allocator=EASTL_VECTOR_MAP_DEFAULT_ALLOCATOR)
 
template<typename InputIterator >
 vector_map (InputIterator first, InputIterator last)
 
template<typename InputIterator >
 vector_map (InputIterator first, InputIterator last, const key_compare &compare)
 
this_typeoperator= (const this_type &x)
 
this_typeoperator= (std::initializer_list< value_type > ilist)
 
this_typeoperator= (this_type &&x)
 
void swap (this_type &x)
 
const key_compare & key_comp () const
 
key_compare & key_comp ()
 
const value_comparevalue_comp () const
 
value_comparevalue_comp ()
 
template<class... Args>
eastl::pair< iterator, bool > emplace (Args &&... args)
 
template<class... Args>
iterator emplace_hint (const_iterator position, Args &&... args)
 
template<typename P , typename = eastl::enable_if_t<eastl::is_constructible_v<value_type, P&&>>>
pair< iterator, bool > insert (P &&otherValue)
 
eastl::pair< iterator, bool > insert (const value_type &value)
 
pair< iterator, bool > insert (const key_type &otherValue)
 
pair< iterator, bool > insert (key_type &&otherValue)
 
iterator insert (const_iterator position, const value_type &value)
 
iterator insert (const_iterator position, value_type &&value)
 
void insert (std::initializer_list< value_type > ilist)
 
template<typename InputIterator >
void insert (InputIterator first, InputIterator last)
 
iterator erase (const_iterator position)
 
iterator erase (const_iterator first, const_iterator last)
 
size_type erase (const key_type &k)
 
reverse_iterator erase (const_reverse_iterator position)
 
reverse_iterator erase (const_reverse_iterator first, const_reverse_iterator last)
 
iterator find (const key_type &k)
 
const_iterator find (const key_type &k) const
 
template<typename U , typename BinaryPredicate >
iterator find_as (const U &u, BinaryPredicate predicate)
 
template<typename U , typename BinaryPredicate >
const_iterator find_as (const U &u, BinaryPredicate predicate) const
 
size_type count (const key_type &k) const
 
iterator lower_bound (const key_type &k)
 
const_iterator lower_bound (const key_type &k) const
 
iterator upper_bound (const key_type &k)
 
const_iterator upper_bound (const key_type &k) const
 
eastl::pair< iterator, iterator > equal_range (const key_type &k)
 
eastl::pair< const_iterator, const_iterator > equal_range (const key_type &k) const
 
template<typename U , typename BinaryPredicate >
eastl::pair< iterator, iterator > equal_range (const U &u, BinaryPredicate predicate)
 
template<typename U , typename BinaryPredicate >
eastl::pair< const_iterator, const_iterator > equal_range (const U &u, BinaryPredicate) const
 
mapped_type & operator[] (const key_type &k)
 
mapped_type & operator[] (key_type &&k)
 
void push_back (const value_type &value)=delete
 
reference push_back ()=delete
 
void * push_back_uninitialized ()=delete
 
template<class... Args>
reference emplace_back (Args &&...)=delete
 
template<typename... Args>
decltype(auto) push_back_unsorted (Args &&... args)
 
template<typename... Args>
decltype(auto) emplace_back_unsorted (Args &&... args)
 
template<class... Args>
eastl::pair< typename vector_map< K, T, C, A, RAC >::iterator, bool > emplace (Args &&... args)
 
template<typename P , typename >
eastl::pair< typename vector_map< K, T, C, A, RAC >::iterator, bool > insert (P &&otherValue)
 
template<typename U , typename BinaryPredicate >
eastl::pair< typename vector_map< K, T, C, A, RAC >::iterator, typename vector_map< K, T, C, A, RAC >::iterator > equal_range (const U &u, BinaryPredicate predicate)
 
template<typename U , typename BinaryPredicate >
eastl::pair< typename vector_map< K, T, C, A, RAC >::const_iterator, typename vector_map< K, T, C, A, RAC >::const_iterator > equal_range (const U &u, BinaryPredicate predicate) const
 
- Public Member Functions inherited from eastl::vector< eastl::pair< Key, T >, EASTLAllocatorType >
 vector (const allocator_type &allocator) EA_NOEXCEPT
 
 vector (size_type n, const allocator_type &allocator=EASTL_VECTOR_DEFAULT_ALLOCATOR)
 
 vector (size_type n, const value_type &value, const allocator_type &allocator=EASTL_VECTOR_DEFAULT_ALLOCATOR)
 
 vector (const this_type &x)
 
 vector (const this_type &x, const allocator_type &allocator)
 
 vector (this_type &&x) EA_NOEXCEPT
 
 vector (this_type &&x, const allocator_type &allocator)
 
 vector (std::initializer_list< value_type > ilist, const allocator_type &allocator=EASTL_VECTOR_DEFAULT_ALLOCATOR)
 
 vector (InputIterator first, InputIterator last, const allocator_type &allocator=EASTL_VECTOR_DEFAULT_ALLOCATOR)
 
this_typeoperator= (const this_type &x)
 
this_typeoperator= (std::initializer_list< value_type > ilist)
 
this_typeoperator= (this_type &&x)
 
void swap (this_type &x)
 
void assign (size_type n, const value_type &value)
 
void assign (InputIterator first, InputIterator last)
 
void assign (std::initializer_list< value_type > ilist)
 
iterator begin () EA_NOEXCEPT
 
const_iterator begin () const EA_NOEXCEPT
 
const_iterator cbegin () const EA_NOEXCEPT
 
iterator end () EA_NOEXCEPT
 
const_iterator end () const EA_NOEXCEPT
 
const_iterator cend () const EA_NOEXCEPT
 
reverse_iterator rbegin () EA_NOEXCEPT
 
const_reverse_iterator rbegin () const EA_NOEXCEPT
 
const_reverse_iterator crbegin () const EA_NOEXCEPT
 
reverse_iterator rend () EA_NOEXCEPT
 
const_reverse_iterator rend () const EA_NOEXCEPT
 
const_reverse_iterator crend () const EA_NOEXCEPT
 
bool empty () const EA_NOEXCEPT
 
size_type size () const EA_NOEXCEPT
 
size_type capacity () const EA_NOEXCEPT
 
void resize (size_type n, const value_type &value)
 
void resize (size_type n)
 
void reserve (size_type n)
 
void set_capacity (size_type n=base_type::npos)
 
void shrink_to_fit ()
 
pointer data () EA_NOEXCEPT
 
const_pointer data () const EA_NOEXCEPT
 
reference operator[] (size_type n)
 
const_reference operator[] (size_type n) const
 
reference at (size_type n)
 
const_reference at (size_type n) const
 
reference front ()
 
const_reference front () const
 
reference back ()
 
const_reference back () const
 
void push_back (const value_type &value)
 
reference push_back ()
 
void push_back (value_type &&value)
 
void * push_back_uninitialized ()
 
void pop_back ()
 
iterator emplace (const_iterator position, Args &&... args)
 
reference emplace_back (Args &&... args)
 
iterator insert (const_iterator position, const value_type &value)
 
iterator insert (const_iterator position, size_type n, const value_type &value)
 
iterator insert (const_iterator position, value_type &&value)
 
iterator insert (const_iterator position, std::initializer_list< value_type > ilist)
 
iterator insert (const_iterator position, InputIterator first, InputIterator last)
 
iterator erase_first (const eastl::pair< Key, T > &value)
 
iterator erase_first_unsorted (const eastl::pair< Key, T > &value)
 
reverse_iterator erase_last (const eastl::pair< Key, T > &value)
 
reverse_iterator erase_last_unsorted (const eastl::pair< Key, T > &value)
 
iterator erase (const_iterator position)
 
iterator erase (const_iterator first, const_iterator last)
 
reverse_iterator erase (const_reverse_iterator position)
 
reverse_iterator erase (const_reverse_iterator first, const_reverse_iterator last)
 
iterator erase_unsorted (const_iterator position)
 
reverse_iterator erase_unsorted (const_reverse_iterator position)
 
void clear () EA_NOEXCEPT
 
void reset_lose_memory () EA_NOEXCEPT
 
bool validate () const EA_NOEXCEPT
 
int validate_iterator (const_iterator i) const EA_NOEXCEPT
 
size_type GetNewCapacity (size_type currentCapacity)
 
eastl::pair< Key, T > * DoAllocate (size_type n)
 
void DoFree (eastl::pair< Key, T > *p, size_type n)
 
eastl::pair< Key, T > *& internalCapacityPtr () EA_NOEXCEPT
 
eastl::pair< Key, T > *const & internalCapacityPtr () const EA_NOEXCEPT
 
allocator_type & internalAllocator () EA_NOEXCEPT
 
const allocator_type & internalAllocator () const EA_NOEXCEPT
 
- Public Member Functions inherited from eastl::VectorBase< eastl::pair< Key, T >, EASTLAllocatorType >
 VectorBase (const allocator_type &allocator)
 
 VectorBase (size_type n, const allocator_type &allocator)
 
const allocator_type & get_allocator () const EA_NOEXCEPT
 
allocator_type & get_allocator () EA_NOEXCEPT
 
void set_allocator (const allocator_type &allocator)
 

Protected Attributes

value_compare mValueCompare
 
- Protected Attributes inherited from eastl::VectorBase< eastl::pair< Key, T >, EASTLAllocatorType >
eastl::pair< Key, T > * mpBegin
 -1 is reserved for 'npos'. It also happens to be slightly beneficial that kMaxSize is a value less than -1, as it helps us deal with potential integer wraparound issues.
 
eastl::pair< Key, T > * mpEnd
 
eastl::compressed_pair< eastl::pair< Key, T > *, allocator_type > mCapacityAllocator
 

Additional Inherited Members

- Public Attributes inherited from eastl::vector< eastl::pair< Key, T >, EASTLAllocatorType >
eastl::pair< Key, T > * mpBegin
 -1 is reserved for 'npos'. It also happens to be slightly beneficial that kMaxSize is a value less than -1, as it helps us deal with potential integer wraparound issues.
 
eastl::pair< Key, T > * mpEnd
 
eastl::compressed_pair< eastl::pair< Key, T > *, allocator_type > mCapacityAllocator
 
- Static Public Attributes inherited from eastl::vector< eastl::pair< Key, T >, EASTLAllocatorType >
static const size_type npos
 
- Static Public Attributes inherited from eastl::VectorBase< eastl::pair< Key, T >, EASTLAllocatorType >
static const size_type npos
 
static const size_type kMaxSize
 'npos' means non-valid position or simply non-position.
 
- Protected Types inherited from eastl::vector< eastl::pair< Key, T >, EASTLAllocatorType >
using should_copy_tag = should_move_or_copy_tag< false >
 
using should_move_tag = should_move_or_copy_tag< true >
 
- Protected Member Functions inherited from eastl::vector< eastl::pair< Key, T >, EASTLAllocatorType >
pointer DoRealloc (size_type n, ForwardIterator first, ForwardIterator last, should_copy_tag)
 
pointer DoRealloc (size_type n, ForwardIterator first, ForwardIterator last, should_move_tag)
 
void DoInit (Integer n, Integer value, true_type)
 
void DoInit (InputIterator first, InputIterator last, false_type)
 
void DoInitFromIterator (InputIterator first, InputIterator last, EASTL_ITC_NS::input_iterator_tag)
 
void DoInitFromIterator (ForwardIterator first, ForwardIterator last, EASTL_ITC_NS::forward_iterator_tag)
 
void DoAssign (Integer n, Integer value, true_type)
 
void DoAssign (InputIterator first, InputIterator last, false_type)
 
void DoAssignValues (size_type n, const value_type &value)
 
void DoAssignFromIterator (InputIterator first, InputIterator last, EASTL_ITC_NS::input_iterator_tag)
 
void DoAssignFromIterator (RandomAccessIterator first, RandomAccessIterator last, EASTL_ITC_NS::random_access_iterator_tag)
 
void DoInsert (const_iterator position, Integer n, Integer value, true_type)
 
void DoInsert (const_iterator position, InputIterator first, InputIterator last, false_type)
 
void DoInsertFromIterator (const_iterator position, InputIterator first, InputIterator last, EASTL_ITC_NS::input_iterator_tag)
 
void DoInsertFromIterator (const_iterator position, BidirectionalIterator first, BidirectionalIterator last, EASTL_ITC_NS::bidirectional_iterator_tag)
 
void DoInsertValues (const_iterator position, size_type n, const value_type &value)
 
void DoInsertValuesEnd (size_type n)
 
void DoInsertValuesEnd (size_type n, const value_type &value)
 
void DoInsertValue (const_iterator position, Args &&... args)
 
void DoInsertValueEnd (Args &&... args)
 
void DoClearCapacity ()
 
void DoGrow (size_type n)
 
void DoSwap (this_type &x)
 
- Protected Member Functions inherited from eastl::VectorBase< eastl::pair< Key, T >, EASTLAllocatorType >
eastl::pair< Key, T > *& internalCapacityPtr () EA_NOEXCEPT
 
eastl::pair< Key, T > *const & internalCapacityPtr () const EA_NOEXCEPT
 
allocator_type & internalAllocator () EA_NOEXCEPT
 
const allocator_type & internalAllocator () const EA_NOEXCEPT
 
eastl::pair< Key, T > * DoAllocate (size_type n)
 
void DoFree (eastl::pair< Key, T > *p, size_type n)
 
size_type GetNewCapacity (size_type currentCapacity)
 

Detailed Description

template<typename Key, typename T, typename Compare = eastl::less<Key>, typename Allocator = EASTLAllocatorType, typename RandomAccessContainer = eastl::vector<eastl::pair<Key, T>, Allocator>>
class eastl::vector_map< Key, T, Compare, Allocator, RandomAccessContainer >

vector_map

Implements a map via a random access container such as a vector.

Note that with vector_set, vector_multiset, vector_map, vector_multimap that the modification of the container potentially invalidates all existing iterators into the container, unlike what happens with conventional sets and maps.

Note that the erase functions return iterator and not void. This allows for more efficient use of the container and is consistent with the C++ language defect report #130 (DR 130)

Note that we set the value_type to be pair<Key, T> and not pair<const Key, T>. This means that the underlying container (e.g vector) is a container of pair<Key, T>. Our vector and deque implementations are optimized to assign values in-place and using a vector of pair<const Key, T> (note the const) would make it hard to use our existing vector implementation without a lot of headaches. As a result, at least for the time being we do away with the const. This means that the insertion type varies between map and vector_map in that the latter doesn't take const. This also means that a certain amount of automatic safety provided by the implementation is lost, as the compiler will let the wayward user modify a key and thus make the container no longer ordered behind its back.


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