Simple set implemented on top of a std::list. The set is append-only, with lock-free reads and mutex-protected insert. More...
#include <small_map.hpp>
Public Member Functions | |
bool | contains (const K &key) const |
Check whether the given key is stored in this set. More... | |
bool | empty () const |
Return whether this map is empty. More... | |
bool | insert (const K &key) |
Search this set for the key. If it is not found, store the key. More... | |
size_t | size () const |
Return the number of elements of this map. More... | |
Private Attributes | |
::std::list< K > | data |
::std::mutex | mutex |
Simple set implemented on top of a std::list. The set is append-only, with lock-free reads and mutex-protected insert.
This set is suitable for storing a small number of elements, as it uses non-sorted linear lookup of the values. However, if this condition is met, the set is reasonably fast and efficient.
K | Type of the map keys. |
Definition at line 129 of file small_map.hpp.
|
inline |
Check whether the given key is stored in this set.
key | The key to find. |
Definition at line 137 of file small_map.hpp.
|
inline |
Return whether this map is empty.
Definition at line 177 of file small_map.hpp.
|
inline |
Search this set for the key. If it is not found, store the key.
key | The key to find. |
Definition at line 147 of file small_map.hpp.
|
inline |
Return the number of elements of this map.
Definition at line 168 of file small_map.hpp.
|
private |
Definition at line 183 of file small_map.hpp.
|
private |
Definition at line 184 of file small_map.hpp.