Sierra Toolkit  Version of the Day
sierra::vecmap< Key, T, Compare > Class Template Reference

Vector-based std::map functionality. More...

#include <VecMap.hpp>

Public Types

typedef Key key_type
 
typedef T mapped_type
 
typedef Compare key_compare
 
typedef storage::value_type value_type
 
typedef storage::allocator_type allocator_type
 
typedef allocator_type::reference reference
 
typedef allocator_type::const_reference const_reference
 
typedef allocator_type::pointer pointer
 
typedef allocator_type::const_pointer const_pointer
 
typedef storage::size_type size_type
 
typedef storage::difference_type difference_type
 
typedef storage::iterator iterator
 
typedef storage::const_iterator const_iterator
 
typedef storage::reverse_iterator reverse_iterator
 
typedef storage::const_reverse_iterator const_reverse_iterator
 
typedef std::pair< key_type, mapped_type > value_type_unconst_key
 

Public Member Functions

 vecmap (const vecmap< Key, T, Compare > &rhs)
 
vecmap< Key, T, Compare > & operator= (const vecmap< Key, T, Compare > &rhs)
 
void swap (vecmap< Key, T, Compare > &v)
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
reverse_iterator rbegin ()
 
reverse_iterator rend ()
 
const_reverse_iterator rbegin () const
 
const_reverse_iterator rend () const
 
bool empty () const
 
size_type size () const
 
size_type max_size () const
 
std::vector< value_type_unconst_key >::iterator lower_bound_private_comp_ (const key_type &k)
 
std::pair< iterator, bool > insert (const value_type &v)
 
mapped_type & operator[] (const key_type &k)
 
void erase (iterator i)
 
void erase (iterator first, iterator last)
 
size_type erase (const key_type &k)
 
void clear ()
 
key_compare key_comp () const
 
value_compare value_comp () 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
 
iterator find (const key_type &k)
 
const_iterator find (const key_type &k) const
 
size_type count (const key_type &k) const
 
 operator const std::vector< value_type > & () const
 
 operator const std::vector< std::pair< key_type, mapped_type > > & () const
 
void reserve (size_type n)
 
bool operator== (const vecmap< Key, T, Compare > &rhs) const
 
bool operator!= (const vecmap< Key, T, Compare > &rhs) const
 

Detailed Description

template<class Key, class T, class Compare = std::less<Key>>
class sierra::vecmap< Key, T, Compare >

Vector-based std::map functionality.

Purpose: Mimic the 'std::map' interface

This template class mimics the 'std::map' associative container interface; however, its semantics are significantly different. Storage for the map-lite class is provided by the std::vector class where the entries are sorted by key value.

Domain of Applicability

Light weight associative container functionality for small keys and values, e.g. key = integer and value = pointer.

Associative container violations

Modifications to the vecmap contents are linear complexity in violation of the associative container requirement for logarithmic complexity. Furthermore, modification operations are guaranteed to invalidate all iterators after the insert/erase point. Insertion operations may also invalidate all iterators if the storage is reallocated.

Associative container compliance

All non-modifying query operations conform to either the constant or logarithmic complexity.

Definition at line 60 of file VecMap.hpp.


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