My Project
|
A map with iteration in the order of insertion. More...
#include <OrderedMap.hpp>
Public Types | |
using | storage_type = std::vector< std::pair< std::string, T > > |
using | index_type = std::unordered_map< std::string, typename storage_type::size_type, OrderedMapDetail::TruncatedStringHash< MAX_CHARS >, OrderedMapDetail::TruncatedStringEquals< MAX_CHARS > > |
using | iter_type = typename storage_type::iterator |
using | const_iter_type = typename storage_type::const_iterator |
Public Member Functions | |
OrderedMap (const index_type &index, const storage_type &storage) | |
const index_type & | getIndex () const |
const storage_type & | getStorage () const |
std::size_t | count (const std::string &key) const |
T & | operator[] (const std::string &key) |
std::size_t | erase (const std::string &key) |
void | insert (std::pair< std::string, T > key_value_pair) |
T & | get (const std::string &key) |
T & | iget (size_t index) |
const T & | get (const std::string &key) const |
const T & | iget (size_t index) const |
const T & | at (size_t index) const |
const T & | at (const std::string &key) const |
T & | at (size_t index) |
T & | at (const std::string &key) |
size_t | size () const |
const_iter_type | begin () const |
const_iter_type | end () const |
iter_type | begin () |
iter_type | end () |
iter_type | find (const std::string &key) |
const_iter_type | find (const std::string &key) const |
template<size_t n> | |
bool | operator== (const OrderedMap< T, n > &data) const |
template<class Serializer > | |
void | serializeOp (Serializer &serializer) |
A map with iteration in the order of insertion.
Each entry has an associated index indicating when a value with that key was first inserted. When iterating over the entries, elements with a lower insertion index are traversed before elements with a higher insertion index.
T | Element type. The map's value type is pair<string, T>
|
MAX_CHARS | Maximum number of characters used in key comparisons. Default value honors all characters. Keys with the same first MAX_CHARS characters are considered equal. |