Infrared
Loading...
Searching...
No Matches
ired::SimpleMap< key_t, val_t > Class Template Reference

Space saving replacement for map. More...

#include <simple_map.hpp>

Inheritance diagram for ired::SimpleMap< key_t, val_t >:
Collaboration diagram for ired::SimpleMap< key_t, val_t >:

Public Member Functions

 SimpleMap ()
 
const_iterator find (const key_t &key) const
 
iterator find (const key_t &key)
 
bool exists (const key_t &key) const
 
auto end () const
 
void push_ascending (const key_t &key, const val_t &val)
 push in ascending order of keys
 
void erase (iterator it)
 
size_t size () const
 
size_t capacity () const
 
void reallocate ()
 

Detailed Description

template<class key_t, class val_t>
class ired::SimpleMap< key_t, val_t >

Space saving replacement for map.

Maintains lists of values in idx sorted lists, allowing log-time access and efficient traversal. Erasing elements is supported, but takes linear time. Still, this data structure seems to be a good compromise, since e.g. balanced trees or hashs require a lot of space.

Constructor & Destructor Documentation

◆ SimpleMap()

template<class key_t , class val_t >
ired::SimpleMap< key_t, val_t >::SimpleMap ( )
inline

Member Function Documentation

◆ capacity()

template<class key_t , class val_t >
size_t ired::SimpleMap< key_t, val_t >::capacity ( ) const
inline

◆ end()

template<class key_t , class val_t >
auto ired::SimpleMap< key_t, val_t >::end ( ) const
inline

◆ erase()

template<class key_t , class val_t >
void ired::SimpleMap< key_t, val_t >::erase ( iterator  it)
inline

◆ exists()

template<class key_t , class val_t >
bool ired::SimpleMap< key_t, val_t >::exists ( const key_t &  key) const
inline

◆ find() [1/2]

template<class key_t , class val_t >
iterator ired::SimpleMap< key_t, val_t >::find ( const key_t &  key)
inline

◆ find() [2/2]

template<class key_t , class val_t >
const_iterator ired::SimpleMap< key_t, val_t >::find ( const key_t &  key) const
inline

◆ push_ascending()

template<class key_t , class val_t >
void ired::SimpleMap< key_t, val_t >::push_ascending ( const key_t &  key,
const val_t &  val 
)
inline

push in ascending order of keys

Parameters
key
val

successive push_ascending must be in ascending order of the key type

◆ reallocate()

template<class key_t , class val_t >
void ired::SimpleMap< key_t, val_t >::reallocate ( )
inline

◆ size()

template<class key_t , class val_t >
size_t ired::SimpleMap< key_t, val_t >::size ( ) const
inline

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