My Project
Loading...
Searching...
No Matches
Opm::OrderedMap< T, MAX_CHARS > Class Template Reference

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)
 

Detailed Description

template<typename T, std::string_view::size_type MAX_CHARS = std::string_view::npos>
class Opm::OrderedMap< T, MAX_CHARS >

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.

Template Parameters
TElement type. The map's value type is
pair<string, T>
.
MAX_CHARSMaximum number of characters used in key comparisons. Default value honors all characters. Keys with the same first MAX_CHARS characters are considered equal.

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