template<class Key, class T, class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
class cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::locked_table
An ownership wrapper around a cuckoohash_map table instance. When given a table instance, it takes all the locks on the table, blocking all outside operations on the table. Because the locked_table has unique ownership of the table, it can provide a set of operations on the table that aren't possible in a concurrent context.
The locked_table interface is very similar to the STL unordered_map interface, and for functions whose signatures correspond to unordered_map methods, the behavior should be mostly the same.
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
template<typename K >
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
template<typename K >
const mapped_type& cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::locked_table::at |
( |
const K & |
key | ) |
const |
|
inline |
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
Returns an iterator to the beginning of the table. If the table is empty, it will point past the end of the table.
- Returns
- an iterator to the beginning of the table
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
Returns an iterator past the end of the table.
- Returns
- an iterator past the end of the table
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
template<typename K >
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
References cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::locked_table::const_iterator::index_, and cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::locked_table::const_iterator::slot_.
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
References cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::locked_table::const_iterator::index_, and cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::locked_table::const_iterator::slot_.
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
template<typename K , typename... Args>
std::pair<iterator, bool> cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::locked_table::insert |
( |
K && |
key, |
|
|
Args &&... |
val |
|
) |
| |
|
inline |
This behaves like the unordered_map::try_emplace
method. It will always invalidate all iterators, due to the possibilities of cuckoo hashing and expansion.
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
bool cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::locked_table::is_active |
( |
| ) |
const |
|
inline |
Returns whether the locked table has ownership of the table
- Returns
- true if it still has ownership, false otherwise
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
bool cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::locked_table::operator!= |
( |
const locked_table & |
lt | ) |
const |
|
inline |
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
bool cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::locked_table::operator== |
( |
const locked_table & |
lt | ) |
const |
|
inline |
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
template<typename K >
T& cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::locked_table::operator[] |
( |
K && |
key | ) |
|
|
inline |
This function has the same lifetime properties as cuckoohash_map::insert, except that the value is default-constructed, with no parameters, if it is not already in the table.
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
Referenced by cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::locked_table::operator!=(), and cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::locked_table::operator==().
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
static constexpr size_type cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::locked_table::slot_per_bucket |
( |
| ) |
|
|
inlinestaticconstexpr |
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
void cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::locked_table::unlock |
( |
| ) |
|
|
inline |
Unlocks the table, thereby freeing the locks on the table, but also invalidating all iterators and table operations with this object. It is idempotent.