userver: multi_index_lru::Container< Value, IndexSpecifierList, Allocator > Class Template Reference
Loading...
Searching...
No Matches
multi_index_lru::Container< Value, IndexSpecifierList, Allocator > Class Template Reference

#include </data/code/userver/libraries/multi-index-lru/include/userver/multi-index-lru/container.hpp>

Detailed Description

template<typename Value, typename IndexSpecifierList, typename Allocator = std::allocator<Value>>
class multi_index_lru::Container< Value, IndexSpecifierList, Allocator >

MultiIndex LRU container.

Definition at line 21 of file container.hpp.

Public Member Functions

 Container (size_t max_size)
 
template<typename... Args>
auto emplace (Args &&... args)
 Constructs element in-place.
 
bool insert (const Value &value)
 
bool insert (Value &&value)
 
template<typename Tag, typename Key>
auto find (const Key &key)
 
template<typename Tag, typename Key>
auto find_no_update (const Key &key) const
 
template<typename Tag, typename Key>
auto equal_range (const Key &key)
 Returns range of matching elements, updates all.
 
template<typename Tag, typename Key>
auto equal_range_no_update (const Key &key) const
 Returns range of matching elements without updates.
 
template<typename Tag, typename Key>
bool contains (const Key &key)
 
template<typename Tag, typename Key>
bool contains_no_update (const Key &key) const
 
template<typename IteratorType>
auto erase (IteratorType it)
 
template<typename Tag, typename Key>
bool erase (const Key &key)
 
std::size_t size () const noexcept
 
bool empty () const noexcept
 
std::size_t capacity () const noexcept
 
void set_capacity (std::size_t new_capacity)
 
void shrink_to_fit ()
 Clears the internal nodes pool.
 
void clear ()
 
template<typename Tag>
auto end () const
 Returns end iterator for the specified Tag index.
 
auto find_last_accessed_no_update () const
 

Constructor & Destructor Documentation

◆ Container()

template<typename Value, typename IndexSpecifierList, typename Allocator = std::allocator<Value>>
multi_index_lru::Container< Value, IndexSpecifierList, Allocator >::Container ( size_t max_size)
inlineexplicit

Definition at line 23 of file container.hpp.

Member Function Documentation

◆ capacity()

template<typename Value, typename IndexSpecifierList, typename Allocator = std::allocator<Value>>
std::size_t multi_index_lru::Container< Value, IndexSpecifierList, Allocator >::capacity ( ) const
inlinenoexcept

Definition at line 136 of file container.hpp.

◆ clear()

template<typename Value, typename IndexSpecifierList, typename Allocator = std::allocator<Value>>
void multi_index_lru::Container< Value, IndexSpecifierList, Allocator >::clear ( )
inline

Removes all elements from the container, leaving the node in an internal pool. The keys and values are not destroyed and are reused on next insertion.

Definition at line 157 of file container.hpp.

◆ contains()

template<typename Value, typename IndexSpecifierList, typename Allocator = std::allocator<Value>>
template<typename Tag, typename Key>
bool multi_index_lru::Container< Value, IndexSpecifierList, Allocator >::contains ( const Key & key)
inline

Definition at line 100 of file container.hpp.

◆ contains_no_update()

template<typename Value, typename IndexSpecifierList, typename Allocator = std::allocator<Value>>
template<typename Tag, typename Key>
bool multi_index_lru::Container< Value, IndexSpecifierList, Allocator >::contains_no_update ( const Key & key) const
inline

Definition at line 105 of file container.hpp.

◆ emplace()

template<typename Value, typename IndexSpecifierList, typename Allocator = std::allocator<Value>>
template<typename... Args>
auto multi_index_lru::Container< Value, IndexSpecifierList, Allocator >::emplace ( Args &&... args)
inline

Constructs element in-place.

Returns
pair<iterator, bool>

Definition at line 30 of file container.hpp.

◆ empty()

template<typename Value, typename IndexSpecifierList, typename Allocator = std::allocator<Value>>
bool multi_index_lru::Container< Value, IndexSpecifierList, Allocator >::empty ( ) const
inlinenoexcept

Definition at line 134 of file container.hpp.

◆ end()

template<typename Value, typename IndexSpecifierList, typename Allocator = std::allocator<Value>>
template<typename Tag>
auto multi_index_lru::Container< Value, IndexSpecifierList, Allocator >::end ( ) const
inline

Returns end iterator for the specified Tag index.

Definition at line 167 of file container.hpp.

◆ equal_range()

template<typename Value, typename IndexSpecifierList, typename Allocator = std::allocator<Value>>
template<typename Tag, typename Key>
auto multi_index_lru::Container< Value, IndexSpecifierList, Allocator >::equal_range ( const Key & key)
inline

Returns range of matching elements, updates all.

Definition at line 78 of file container.hpp.

◆ equal_range_no_update()

template<typename Value, typename IndexSpecifierList, typename Allocator = std::allocator<Value>>
template<typename Tag, typename Key>
auto multi_index_lru::Container< Value, IndexSpecifierList, Allocator >::equal_range_no_update ( const Key & key) const
inline

Returns range of matching elements without updates.

Definition at line 95 of file container.hpp.

◆ erase() [1/2]

template<typename Value, typename IndexSpecifierList, typename Allocator = std::allocator<Value>>
template<typename Tag, typename Key>
bool multi_index_lru::Container< Value, IndexSpecifierList, Allocator >::erase ( const Key & key)
inline

Removes the key from container, leaving the node in an internal pool. The key and value are not destroyed and are reused on next insertion.

Definition at line 127 of file container.hpp.

◆ erase() [2/2]

template<typename Value, typename IndexSpecifierList, typename Allocator = std::allocator<Value>>
template<typename IteratorType>
auto multi_index_lru::Container< Value, IndexSpecifierList, Allocator >::erase ( IteratorType it)
inline

Removes the it from container, leaving the node in an internal pool. The key and value are not destroyed and are reused on next insertion.

Definition at line 112 of file container.hpp.

◆ find()

template<typename Value, typename IndexSpecifierList, typename Allocator = std::allocator<Value>>
template<typename Tag, typename Key>
auto multi_index_lru::Container< Value, IndexSpecifierList, Allocator >::find ( const Key & key)
inline

Definition at line 58 of file container.hpp.

◆ find_last_accessed_no_update()

template<typename Value, typename IndexSpecifierList, typename Allocator = std::allocator<Value>>
auto multi_index_lru::Container< Value, IndexSpecifierList, Allocator >::find_last_accessed_no_update ( ) const
inline

Definition at line 171 of file container.hpp.

◆ find_no_update()

template<typename Value, typename IndexSpecifierList, typename Allocator = std::allocator<Value>>
template<typename Tag, typename Key>
auto multi_index_lru::Container< Value, IndexSpecifierList, Allocator >::find_no_update ( const Key & key) const
inline

Definition at line 72 of file container.hpp.

◆ insert() [1/2]

template<typename Value, typename IndexSpecifierList, typename Allocator = std::allocator<Value>>
bool multi_index_lru::Container< Value, IndexSpecifierList, Allocator >::insert ( const Value & value)
inline

Definition at line 53 of file container.hpp.

◆ insert() [2/2]

template<typename Value, typename IndexSpecifierList, typename Allocator = std::allocator<Value>>
bool multi_index_lru::Container< Value, IndexSpecifierList, Allocator >::insert ( Value && value)
inline

Definition at line 55 of file container.hpp.

◆ set_capacity()

template<typename Value, typename IndexSpecifierList, typename Allocator = std::allocator<Value>>
void multi_index_lru::Container< Value, IndexSpecifierList, Allocator >::set_capacity ( std::size_t new_capacity)
inline

Definition at line 138 of file container.hpp.

◆ shrink_to_fit()

template<typename Value, typename IndexSpecifierList, typename Allocator = std::allocator<Value>>
void multi_index_lru::Container< Value, IndexSpecifierList, Allocator >::shrink_to_fit ( )
inline

Clears the internal nodes pool.

Definition at line 153 of file container.hpp.

◆ size()

template<typename Value, typename IndexSpecifierList, typename Allocator = std::allocator<Value>>
std::size_t multi_index_lru::Container< Value, IndexSpecifierList, Allocator >::size ( ) const
inlinenoexcept

Definition at line 132 of file container.hpp.


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