Loading...
Searching...
No Matches
robin_hash< ValueType, KeySelect, ValueSelect, Hash, KeyEqual, Allocator, StoreHash, GrowthPolicy >::robin_iterator< IsConst > Class Template Reference

The 'operator*()' and 'operator->()' methods return a const reference and const pointer respectively to the stored value type. More...

#include <robin_hash.h>

Public Types

using iterator_category = std::forward_iterator_tag
 
using value_type = const typename robin_hash::value_type
 
using difference_type = std::ptrdiff_t
 
using reference = value_type &
 
using pointer = value_type *
 

Public Member Functions

template<bool TIsConst = IsConst, typename std::enable_if< TIsConst >::type * = nullptr>
 robin_iterator (const robin_iterator<!TIsConst > &other) noexcept
 
 robin_iterator (const robin_iterator &other)=default
 
 robin_iterator (robin_iterator &&other)=default
 
robin_iteratoroperator= (const robin_iterator &other)=default
 
robin_iteratoroperator= (robin_iterator &&other)=default
 
const robin_hash::key_type & key () const
 
template<class U = ValueSelect, typename std::enable_if< has_mapped_type< U >::value &&IsConst >::type * = nullptr>
const U::value_type & value () const
 
template<class U = ValueSelect, typename std::enable_if< has_mapped_type< U >::value &&!IsConst >::type * = nullptr>
U::value_type & value () const
 
reference operator* () const
 
pointer operator-> () const
 
robin_iteratoroperator++ ()
 
robin_iterator operator++ (int)
 

Friends

class robin_hash
 
bool operator== (const robin_iterator &lhs, const robin_iterator &rhs)
 
bool operator!= (const robin_iterator &lhs, const robin_iterator &rhs)
 

Detailed Description

template<class ValueType, class KeySelect, class ValueSelect, class Hash, class KeyEqual, class Allocator, bool StoreHash, class GrowthPolicy>
template<bool IsConst>
class pxr_tsl::detail_robin_hash::robin_hash< ValueType, KeySelect, ValueSelect, Hash, KeyEqual, Allocator, StoreHash, GrowthPolicy >::robin_iterator< IsConst >

The 'operator*()' and 'operator->()' methods return a const reference and const pointer respectively to the stored value type.

In case of a map, to get a mutable reference to the value associated to a key (the '.second' in the stored pair), you have to call 'value()'.

The main reason for this is that if we returned a std::pair<Key, T>& instead of a const std::pair<Key, T>&, the user may modify the key which will put the map in a undefined state.

Definition at line 448 of file robin_hash.h.

Member Typedef Documentation

◆ difference_type

using difference_type = std::ptrdiff_t

Definition at line 461 of file robin_hash.h.

◆ iterator_category

using iterator_category = std::forward_iterator_tag

Definition at line 459 of file robin_hash.h.

◆ pointer

using pointer = value_type*

Definition at line 463 of file robin_hash.h.

◆ reference

using reference = value_type&

Definition at line 462 of file robin_hash.h.

◆ value_type

using value_type = const typename robin_hash::value_type

Definition at line 460 of file robin_hash.h.

Constructor & Destructor Documentation

◆ robin_iterator() [1/2]

robin_iterator ( )
inlinenoexcept

Definition at line 465 of file robin_hash.h.

◆ robin_iterator() [2/2]

robin_iterator ( const robin_iterator<!TIsConst > &  other)
inlinenoexcept

Definition at line 470 of file robin_hash.h.

Member Function Documentation

◆ key()

const robin_hash::key_type & key ( ) const
inline

Definition at line 478 of file robin_hash.h.

◆ operator*()

reference operator* ( ) const
inline

Definition at line 496 of file robin_hash.h.

◆ operator++() [1/2]

robin_iterator & operator++ ( )
inline

Definition at line 500 of file robin_hash.h.

◆ operator++() [2/2]

robin_iterator operator++ ( int  )
inline

Definition at line 514 of file robin_hash.h.

◆ operator->()

pointer operator-> ( ) const
inline

Definition at line 498 of file robin_hash.h.

◆ value() [1/2]

const U::value_type & value ( ) const
inline

Definition at line 485 of file robin_hash.h.

◆ value() [2/2]

U::value_type & value ( ) const
inline

Definition at line 492 of file robin_hash.h.

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( const robin_iterator< IsConst > &  lhs,
const robin_iterator< IsConst > &  rhs 
)
friend

Definition at line 526 of file robin_hash.h.

◆ operator==

bool operator== ( const robin_iterator< IsConst > &  lhs,
const robin_iterator< IsConst > &  rhs 
)
friend

Definition at line 521 of file robin_hash.h.

◆ robin_hash

friend class robin_hash
friend

Definition at line 449 of file robin_hash.h.


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