Template Class SmallSet
Defined in File small_map.hpp
Class Documentation
-
template<typename K>
class SmallSet 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.
- Template Parameters:
K – Type of the map keys.
Public Functions
-
inline bool contains(const K &key) const
Check whether the given key is stored in this set.
- Parameters:
key – The key to find.
- Returns:
Whether the key is stored in this set.
-
inline bool insert(const K &key)
Search this set for the key. If it is not found, store the key.
- Parameters:
key – The key to find.
- Returns:
Whether the key was missing and was inserted.
-
inline size_t size() const
Return the number of elements of this map.
- Returns:
The number of elements.
-
inline bool empty() const
Return whether this map is empty.
- Returns:
Whether the map is empty.