OR-Tools  9.3
linked_hash_map< Key, Value, KeyHash, KeyEq, Alloc >

Detailed Description

template<typename Key, typename Value, typename KeyHash = typename absl::flat_hash_set<Key>::hasher, typename KeyEq = typename absl::flat_hash_set<Key, KeyHash>::key_equal, typename Alloc = std::allocator<std::pair<const Key, Value>>>
class gtl::linked_hash_map< Key, Value, KeyHash, KeyEq, Alloc >

Definition at line 52 of file linked_hash_map.h.

Public Types

using key_type = Key
 
using mapped_type = Value
 
using hasher = KeyHash
 
using key_equal = KeyEq
 
using value_type = std::pair< const key_type, mapped_type >
 
using allocator_type = Alloc
 
using difference_type = ptrdiff_t
 
using iterator = typename ListType::iterator
 
using const_iterator = typename ListType::const_iterator
 
using reverse_iterator = typename ListType::reverse_iterator
 
using const_reverse_iterator = typename ListType::const_reverse_iterator
 
using reference = typename ListType::reference
 
using const_reference = typename ListType::const_reference
 
using size_type = typename ListType::size_type
 
using pointer = typename std::allocator_traits< allocator_type >::pointer
 
using const_pointer = typename std::allocator_traits< allocator_type >::const_pointer
 
using node_type = NodeHandle
 
using insert_return_type = InsertReturnType< iterator, node_type >
 

Public Member Functions

 linked_hash_map ()
 
 linked_hash_map (size_t bucket_count, const hasher &hash=hasher(), const key_equal &eq=key_equal(), const allocator_type &alloc=allocator_type())
 
 linked_hash_map (size_t bucket_count, const hasher &hash, const allocator_type &alloc)
 
 linked_hash_map (size_t bucket_count, const allocator_type &alloc)
 
 linked_hash_map (const allocator_type &alloc)
 
template<class InputIt >
 linked_hash_map (InputIt first, InputIt last, size_t bucket_count=0, const hasher &hash=hasher(), const key_equal &eq=key_equal(), const allocator_type &alloc=allocator_type())
 
template<class InputIt >
 linked_hash_map (InputIt first, InputIt last, size_t bucket_count, const hasher &hash, const allocator_type &alloc)
 
template<class InputIt >
 linked_hash_map (InputIt first, InputIt last, size_t bucket_count, const allocator_type &alloc)
 
template<class InputIt >
 linked_hash_map (InputIt first, InputIt last, const allocator_type &alloc)
 
 linked_hash_map (std::initializer_list< value_type > init, size_t bucket_count=0, const hasher &hash=hasher(), const key_equal &eq=key_equal(), const allocator_type &alloc=allocator_type())
 
 linked_hash_map (std::initializer_list< value_type > init, size_t bucket_count, const hasher &hash, const allocator_type &alloc)
 
 linked_hash_map (std::initializer_list< value_type > init, size_t bucket_count, const allocator_type &alloc)
 
 linked_hash_map (std::initializer_list< value_type > init, const allocator_type &alloc)
 
 linked_hash_map (const linked_hash_map &other)
 
 linked_hash_map (const linked_hash_map &other, const allocator_type &alloc)
 
 linked_hash_map (linked_hash_map &&other) noexcept
 
 linked_hash_map (linked_hash_map &&other, const allocator_type &alloc)
 
linked_hash_mapoperator= (const linked_hash_map &other)
 
linked_hash_mapoperator= (linked_hash_map &&other) noexcept
 
linked_hash_mapoperator= (std::initializer_list< value_type > values)
 
size_type size () const
 
size_type max_size () const noexcept
 
bool empty () const
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
reverse_iterator rbegin ()
 
reverse_iterator rend ()
 
const_reverse_iterator rbegin () const
 
const_reverse_iterator rend () const
 
const_reverse_iterator crbegin () const
 
const_reverse_iterator crend () const
 
reference front ()
 
reference back ()
 
const_reference front () const
 
const_reference back () const
 
void pop_front ()
 
void pop_back ()
 
ABSL_ATTRIBUTE_REINITIALIZES void clear ()
 
void reserve (size_t n)
 
size_t capacity () const
 
size_t bucket_count () const
 
float load_factor () const
 
hasher hash_function () const
 
key_equal key_eq () const
 
allocator_type get_allocator () const
 
template<class K = key_type>
size_type erase (const key_arg< K > &key)
 
iterator erase (const_iterator position)
 
iterator erase (iterator position)
 
iterator erase (iterator first, iterator last)
 
iterator erase (const_iterator first, const_iterator last)
 
template<class K = key_type>
iterator find (const key_arg< K > &key)
 
template<class K = key_type>
const_iterator find (const key_arg< K > &key) const
 
template<class K = key_type>
size_type count (const key_arg< K > &key) const
 
template<class K = key_type>
bool contains (const key_arg< K > &key) const
 
template<class K = key_type>
mapped_typeat (const key_arg< K > &key)
 
template<class K = key_type>
const mapped_typeat (const key_arg< K > &key) const
 
template<class K = key_type>
std::pair< iterator, iteratorequal_range (const key_arg< K > &key)
 
template<class K = key_type>
std::pair< const_iterator, const_iteratorequal_range (const key_arg< K > &key) const
 
template<class K = key_type>
mapped_typeoperator[] (const key_arg< K > &key)
 
template<class K = key_type, K * = nullptr>
mapped_typeoperator[] (key_arg< K > &&key)
 
std::pair< iterator, bool > insert (const value_type &v)
 
std::pair< iterator, bool > insert (value_type &&v)
 
iterator insert (const_iterator, const value_type &v)
 
iterator insert (const_iterator, value_type &&v)
 
void insert (std::initializer_list< value_type > ilist)
 
template<class InputIt >
void insert (InputIt first, InputIt last)
 
insert_return_type insert (node_type &&node)
 
iterator insert (const_iterator, node_type &&node)
 
template<class K = key_type, class V = mapped_type, K * = nullptr, V * = nullptr>
std::pair< iterator, bool > insert_or_assign (key_arg< K > &&k, V &&v)
 
template<class K = key_type, class V = mapped_type, K * = nullptr>
std::pair< iterator, bool > insert_or_assign (key_arg< K > &&k, const V &v)
 
template<class K = key_type, class V = mapped_type, V * = nullptr>
std::pair< iterator, bool > insert_or_assign (const key_arg< K > &k, V &&v)
 
template<class K = key_type, class V = mapped_type>
std::pair< iterator, bool > insert_or_assign (const key_arg< K > &k, const V &v)
 
template<class K = key_type, class V = mapped_type, K * = nullptr, V * = nullptr>
iterator insert_or_assign (const_iterator, key_arg< K > &&k, V &&v)
 
template<class K = key_type, class V = mapped_type, K * = nullptr>
iterator insert_or_assign (const_iterator, key_arg< K > &&k, const V &v)
 
template<class K = key_type, class V = mapped_type, V * = nullptr>
iterator insert_or_assign (const_iterator, const key_arg< K > &k, V &&v)
 
template<class K = key_type, class V = mapped_type>
iterator insert_or_assign (const_iterator, const key_arg< K > &k, const V &v)
 
template<typename... Args>
std::pair< iterator, bool > emplace (Args &&... args)
 
template<class K = key_type, class... Args, K * = nullptr>
iterator try_emplace (const_iterator, key_arg< K > &&k, Args &&... args)
 
template<typename... Args>
iterator emplace_hint (const_iterator, Args &&... args)
 
template<class K = key_type, typename... Args, K * = nullptr>
std::pair< iterator, bool > try_emplace (key_arg< K > &&key, Args &&... args)
 
template<typename H , typename E >
void merge (linked_hash_map< Key, Value, H, E, Alloc > &src)
 
template<typename H , typename E >
void merge (linked_hash_map< Key, Value, H, E, Alloc > &&src)
 
node_type extract (const_iterator position)
 
template<class K = key_type, std::enable_if_t<!std::is_same_v< K, iterator >, int > = 0>
node_type extract (const key_arg< K > &key)
 
template<class K = key_type, typename... Args>
std::pair< iterator, bool > try_emplace (const key_arg< K > &key, Args &&... args)
 
void swap (linked_hash_map &other)
 
void rehash (size_t n)
 

Member Typedef Documentation

◆ allocator_type

using allocator_type = Alloc

Definition at line 69 of file linked_hash_map.h.

◆ const_iterator

using const_iterator = typename ListType::const_iterator

Definition at line 141 of file linked_hash_map.h.

◆ const_pointer

using const_pointer = typename std::allocator_traits<allocator_type>::const_pointer

Definition at line 148 of file linked_hash_map.h.

◆ const_reference

using const_reference = typename ListType::const_reference

Definition at line 145 of file linked_hash_map.h.

◆ const_reverse_iterator

using const_reverse_iterator = typename ListType::const_reverse_iterator

Definition at line 143 of file linked_hash_map.h.

◆ difference_type

using difference_type = ptrdiff_t

Definition at line 70 of file linked_hash_map.h.

◆ hasher

using hasher = KeyHash

Definition at line 66 of file linked_hash_map.h.

◆ insert_return_type

using insert_return_type = InsertReturnType<iterator, node_type>

Definition at line 151 of file linked_hash_map.h.

◆ iterator

using iterator = typename ListType::iterator

Definition at line 140 of file linked_hash_map.h.

◆ key_equal

using key_equal = KeyEq

Definition at line 67 of file linked_hash_map.h.

◆ key_type

using key_type = Key

Definition at line 64 of file linked_hash_map.h.

◆ mapped_type

using mapped_type = Value

Definition at line 65 of file linked_hash_map.h.

◆ node_type

using node_type = NodeHandle

Definition at line 150 of file linked_hash_map.h.

◆ pointer

using pointer = typename std::allocator_traits<allocator_type>::pointer

Definition at line 147 of file linked_hash_map.h.

◆ reference

using reference = typename ListType::reference

Definition at line 144 of file linked_hash_map.h.

◆ reverse_iterator

using reverse_iterator = typename ListType::reverse_iterator

Definition at line 142 of file linked_hash_map.h.

◆ size_type

using size_type = typename ListType::size_type

Definition at line 146 of file linked_hash_map.h.

◆ value_type

using value_type = std::pair<const key_type, mapped_type>

Definition at line 68 of file linked_hash_map.h.

Constructor & Destructor Documentation

◆ linked_hash_map() [1/17]

linked_hash_map ( )
inline

Definition at line 153 of file linked_hash_map.h.

◆ linked_hash_map() [2/17]

linked_hash_map ( size_t  bucket_count,
const hasher hash = hasher(),
const key_equal eq = key_equal(),
const allocator_type alloc = allocator_type() 
)
inlineexplicit

Definition at line 155 of file linked_hash_map.h.

◆ linked_hash_map() [3/17]

linked_hash_map ( size_t  bucket_count,
const hasher hash,
const allocator_type alloc 
)
inline

Definition at line 162 of file linked_hash_map.h.

◆ linked_hash_map() [4/17]

linked_hash_map ( size_t  bucket_count,
const allocator_type alloc 
)
inline

Definition at line 166 of file linked_hash_map.h.

◆ linked_hash_map() [5/17]

linked_hash_map ( const allocator_type alloc)
inlineexplicit

Definition at line 169 of file linked_hash_map.h.

◆ linked_hash_map() [6/17]

linked_hash_map ( InputIt  first,
InputIt  last,
size_t  bucket_count = 0,
const hasher hash = hasher(),
const key_equal eq = key_equal(),
const allocator_type alloc = allocator_type() 
)
inline

Definition at line 173 of file linked_hash_map.h.

◆ linked_hash_map() [7/17]

linked_hash_map ( InputIt  first,
InputIt  last,
size_t  bucket_count,
const hasher hash,
const allocator_type alloc 
)
inline

Definition at line 182 of file linked_hash_map.h.

◆ linked_hash_map() [8/17]

linked_hash_map ( InputIt  first,
InputIt  last,
size_t  bucket_count,
const allocator_type alloc 
)
inline

Definition at line 187 of file linked_hash_map.h.

◆ linked_hash_map() [9/17]

linked_hash_map ( InputIt  first,
InputIt  last,
const allocator_type alloc 
)
inline

Definition at line 193 of file linked_hash_map.h.

◆ linked_hash_map() [10/17]

linked_hash_map ( std::initializer_list< value_type init,
size_t  bucket_count = 0,
const hasher hash = hasher(),
const key_equal eq = key_equal(),
const allocator_type alloc = allocator_type() 
)
inline

Definition at line 197 of file linked_hash_map.h.

◆ linked_hash_map() [11/17]

linked_hash_map ( std::initializer_list< value_type init,
size_t  bucket_count,
const hasher hash,
const allocator_type alloc 
)
inline

Definition at line 204 of file linked_hash_map.h.

◆ linked_hash_map() [12/17]

linked_hash_map ( std::initializer_list< value_type init,
size_t  bucket_count,
const allocator_type alloc 
)
inline

Definition at line 208 of file linked_hash_map.h.

◆ linked_hash_map() [13/17]

linked_hash_map ( std::initializer_list< value_type init,
const allocator_type alloc 
)
inline

Definition at line 212 of file linked_hash_map.h.

◆ linked_hash_map() [14/17]

linked_hash_map ( const linked_hash_map< Key, Value, KeyHash, KeyEq, Alloc > &  other)
inline

Definition at line 217 of file linked_hash_map.h.

◆ linked_hash_map() [15/17]

linked_hash_map ( const linked_hash_map< Key, Value, KeyHash, KeyEq, Alloc > &  other,
const allocator_type alloc 
)
inline

Definition at line 223 of file linked_hash_map.h.

◆ linked_hash_map() [16/17]

linked_hash_map ( linked_hash_map< Key, Value, KeyHash, KeyEq, Alloc > &&  other)
inlinenoexcept

Definition at line 229 of file linked_hash_map.h.

◆ linked_hash_map() [17/17]

linked_hash_map ( linked_hash_map< Key, Value, KeyHash, KeyEq, Alloc > &&  other,
const allocator_type alloc 
)
inline

Definition at line 237 of file linked_hash_map.h.

Member Function Documentation

◆ at() [1/2]

mapped_type & at ( const key_arg< K > &  key)
inline

Definition at line 371 of file linked_hash_map.h.

◆ at() [2/2]

const mapped_type & at ( const key_arg< K > &  key) const
inline

Definition at line 380 of file linked_hash_map.h.

◆ back() [1/2]

reference back ( )
inline

Definition at line 292 of file linked_hash_map.h.

◆ back() [2/2]

const_reference back ( ) const
inline

Definition at line 294 of file linked_hash_map.h.

◆ begin() [1/2]

iterator begin ( )
inline

Definition at line 279 of file linked_hash_map.h.

◆ begin() [2/2]

const_iterator begin ( ) const
inline

Definition at line 281 of file linked_hash_map.h.

◆ bucket_count()

size_t bucket_count ( ) const
inline

Definition at line 306 of file linked_hash_map.h.

◆ capacity()

size_t capacity ( ) const
inline

Definition at line 305 of file linked_hash_map.h.

◆ cbegin()

const_iterator cbegin ( ) const
inline

Definition at line 283 of file linked_hash_map.h.

◆ cend()

const_iterator cend ( ) const
inline

Definition at line 284 of file linked_hash_map.h.

◆ clear()

ABSL_ATTRIBUTE_REINITIALIZES void clear ( )
inline

Definition at line 299 of file linked_hash_map.h.

◆ contains()

bool contains ( const key_arg< K > &  key) const
inline

Definition at line 366 of file linked_hash_map.h.

◆ count()

size_type count ( const key_arg< K > &  key) const
inline

Definition at line 362 of file linked_hash_map.h.

◆ crbegin()

const_reverse_iterator crbegin ( ) const
inline

Definition at line 289 of file linked_hash_map.h.

◆ crend()

const_reverse_iterator crend ( ) const
inline

Definition at line 290 of file linked_hash_map.h.

◆ emplace()

std::pair< iterator, bool > emplace ( Args &&...  args)
inline

Definition at line 496 of file linked_hash_map.h.

◆ emplace_hint()

iterator emplace_hint ( const_iterator  ,
Args &&...  args 
)
inline

Definition at line 512 of file linked_hash_map.h.

◆ empty()

bool empty ( ) const
inline

Definition at line 275 of file linked_hash_map.h.

◆ end() [1/2]

iterator end ( )
inline

Definition at line 280 of file linked_hash_map.h.

◆ end() [2/2]

const_iterator end ( ) const
inline

Definition at line 282 of file linked_hash_map.h.

◆ equal_range() [1/2]

std::pair< iterator, iterator > equal_range ( const key_arg< K > &  key)
inline

Definition at line 385 of file linked_hash_map.h.

◆ equal_range() [2/2]

std::pair< const_iterator, const_iterator > equal_range ( const key_arg< K > &  key) const
inline

Definition at line 392 of file linked_hash_map.h.

◆ erase() [1/5]

size_type erase ( const key_arg< K > &  key)
inline

Definition at line 314 of file linked_hash_map.h.

◆ erase() [2/5]

iterator erase ( const_iterator  first,
const_iterator  last 
)
inline

Definition at line 341 of file linked_hash_map.h.

◆ erase() [3/5]

iterator erase ( const_iterator  position)
inline

Definition at line 324 of file linked_hash_map.h.

◆ erase() [4/5]

iterator erase ( iterator  first,
iterator  last 
)
inline

Definition at line 336 of file linked_hash_map.h.

◆ erase() [5/5]

iterator erase ( iterator  position)
inline

Definition at line 332 of file linked_hash_map.h.

◆ extract() [1/2]

node_type extract ( const key_arg< K > &  key)
inline

Definition at line 548 of file linked_hash_map.h.

◆ extract() [2/2]

node_type extract ( const_iterator  position)
inline

Definition at line 539 of file linked_hash_map.h.

◆ find() [1/2]

iterator find ( const key_arg< K > &  key)
inline

Definition at line 348 of file linked_hash_map.h.

◆ find() [2/2]

const_iterator find ( const key_arg< K > &  key) const
inline

Definition at line 355 of file linked_hash_map.h.

◆ front() [1/2]

reference front ( )
inline

Definition at line 291 of file linked_hash_map.h.

◆ front() [2/2]

const_reference front ( ) const
inline

Definition at line 293 of file linked_hash_map.h.

◆ get_allocator()

allocator_type get_allocator ( ) const
inline

Definition at line 311 of file linked_hash_map.h.

◆ hash_function()

hasher hash_function ( ) const
inline

Definition at line 309 of file linked_hash_map.h.

◆ insert() [1/8]

std::pair< iterator, bool > insert ( const value_type v)
inline

Definition at line 410 of file linked_hash_map.h.

◆ insert() [2/8]

iterator insert ( const_iterator  ,
const value_type v 
)
inline

Definition at line 417 of file linked_hash_map.h.

◆ insert() [3/8]

iterator insert ( const_iterator  ,
node_type &&  node 
)
inline

Definition at line 442 of file linked_hash_map.h.

◆ insert() [4/8]

iterator insert ( const_iterator  ,
value_type &&  v 
)
inline

Definition at line 420 of file linked_hash_map.h.

◆ insert() [5/8]

void insert ( InputIt  first,
InputIt  last 
)
inline

Definition at line 429 of file linked_hash_map.h.

◆ insert() [6/8]

insert_return_type insert ( node_type &&  node)
inline

Definition at line 433 of file linked_hash_map.h.

◆ insert() [7/8]

void insert ( std::initializer_list< value_type ilist)
inline

Definition at line 424 of file linked_hash_map.h.

◆ insert() [8/8]

std::pair< iterator, bool > insert ( value_type &&  v)
inline

Definition at line 413 of file linked_hash_map.h.

◆ insert_or_assign() [1/8]

std::pair< iterator, bool > insert_or_assign ( const key_arg< K > &  k,
const V &  v 
)
inline

Definition at line 470 of file linked_hash_map.h.

◆ insert_or_assign() [2/8]

std::pair< iterator, bool > insert_or_assign ( const key_arg< K > &  k,
V &&  v 
)
inline

Definition at line 465 of file linked_hash_map.h.

◆ insert_or_assign() [3/8]

iterator insert_or_assign ( const_iterator  ,
const key_arg< K > &  k,
const V &  v 
)
inline

Definition at line 491 of file linked_hash_map.h.

◆ insert_or_assign() [4/8]

iterator insert_or_assign ( const_iterator  ,
const key_arg< K > &  k,
V &&  v 
)
inline

Definition at line 486 of file linked_hash_map.h.

◆ insert_or_assign() [5/8]

iterator insert_or_assign ( const_iterator  ,
key_arg< K > &&  k,
const V &  v 
)
inline

Definition at line 481 of file linked_hash_map.h.

◆ insert_or_assign() [6/8]

iterator insert_or_assign ( const_iterator  ,
key_arg< K > &&  k,
V &&  v 
)
inline

Definition at line 476 of file linked_hash_map.h.

◆ insert_or_assign() [7/8]

std::pair< iterator, bool > insert_or_assign ( key_arg< K > &&  k,
const V &  v 
)
inline

Definition at line 460 of file linked_hash_map.h.

◆ insert_or_assign() [8/8]

std::pair< iterator, bool > insert_or_assign ( key_arg< K > &&  k,
V &&  v 
)
inline

Definition at line 455 of file linked_hash_map.h.

◆ key_eq()

key_equal key_eq ( ) const
inline

Definition at line 310 of file linked_hash_map.h.

◆ load_factor()

float load_factor ( ) const
inline

Definition at line 307 of file linked_hash_map.h.

◆ max_size()

size_type max_size ( ) const
inlinenoexcept

Definition at line 274 of file linked_hash_map.h.

◆ merge() [1/2]

void merge ( linked_hash_map< Key, Value, H, E, Alloc > &&  src)
inline

Definition at line 535 of file linked_hash_map.h.

◆ merge() [2/2]

void merge ( linked_hash_map< Key, Value, H, E, Alloc > &  src)
inline

Definition at line 523 of file linked_hash_map.h.

◆ operator=() [1/3]

linked_hash_map & operator= ( const linked_hash_map< Key, Value, KeyHash, KeyEq, Alloc > &  other)
inline

Definition at line 246 of file linked_hash_map.h.

◆ operator=() [2/3]

linked_hash_map & operator= ( linked_hash_map< Key, Value, KeyHash, KeyEq, Alloc > &&  other)
inlinenoexcept

Definition at line 257 of file linked_hash_map.h.

◆ operator=() [3/3]

linked_hash_map & operator= ( std::initializer_list< value_type values)
inline

Definition at line 266 of file linked_hash_map.h.

◆ operator[]() [1/2]

mapped_type & operator[] ( const key_arg< K > &  key)
inline

Definition at line 400 of file linked_hash_map.h.

◆ operator[]() [2/2]

mapped_type & operator[] ( key_arg< K > &&  key)
inline

Definition at line 405 of file linked_hash_map.h.

◆ pop_back()

void pop_back ( )
inline

Definition at line 297 of file linked_hash_map.h.

◆ pop_front()

void pop_front ( )
inline

Definition at line 296 of file linked_hash_map.h.

◆ rbegin() [1/2]

reverse_iterator rbegin ( )
inline

Definition at line 285 of file linked_hash_map.h.

◆ rbegin() [2/2]

const_reverse_iterator rbegin ( ) const
inline

Definition at line 287 of file linked_hash_map.h.

◆ rehash()

void rehash ( size_t  n)
inline

Definition at line 582 of file linked_hash_map.h.

◆ rend() [1/2]

reverse_iterator rend ( )
inline

Definition at line 286 of file linked_hash_map.h.

◆ rend() [2/2]

const_reverse_iterator rend ( ) const
inline

Definition at line 288 of file linked_hash_map.h.

◆ reserve()

void reserve ( size_t  n)
inline

Definition at line 304 of file linked_hash_map.h.

◆ size()

size_type size ( ) const
inline

Definition at line 273 of file linked_hash_map.h.

◆ swap()

void swap ( linked_hash_map< Key, Value, KeyHash, KeyEq, Alloc > &  other)
inline

Definition at line 558 of file linked_hash_map.h.

◆ try_emplace() [1/3]

std::pair< iterator, bool > try_emplace ( const key_arg< K > &  key,
Args &&...  args 
)
inline

Definition at line 554 of file linked_hash_map.h.

◆ try_emplace() [2/3]

iterator try_emplace ( const_iterator  ,
key_arg< K > &&  k,
Args &&...  args 
)
inline

Definition at line 507 of file linked_hash_map.h.

◆ try_emplace() [3/3]

std::pair< iterator, bool > try_emplace ( key_arg< K > &&  key,
Args &&...  args 
)
inline

Definition at line 517 of file linked_hash_map.h.


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