CppCommon  1.0.4.1
C++ Common Library
Public Types | Public Member Functions | Friends | List of all members
CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator > Class Template Reference

Flat map container. More...

#include <flatmap.h>

Public Types

typedef TKey key_type
 
typedef TValue mapped_type
 
typedef std::pair< TKey, TValue > value_type
 
typedef value_typereference
 
typedef const value_typeconst_reference
 
typedef value_typepointer
 
typedef const value_typeconst_pointer
 
typedef ptrdiff_t difference_type
 
typedef size_t size_type
 
typedef std::vector< value_type, TAllocator >::iterator iterator
 
typedef std::vector< value_type, TAllocator >::const_iterator const_iterator
 
typedef std::vector< value_type, TAllocator >::reverse_iterator reverse_iterator
 
typedef std::vector< value_type, TAllocator >::const_reverse_iterator const_reverse_iterator
 

Public Member Functions

 FlatMap (size_t capacity=128, const TCompare &compare=TCompare(), const TAllocator &allocator=TAllocator())
 Initialize the flat map with a given capacity. More...
 
template<class InputIterator >
 FlatMap (InputIterator first, InputIterator last, bool unused, size_t capacity=128, const TCompare &compare=TCompare(), const TAllocator &allocator=TAllocator())
 
 FlatMap (const FlatMap &flatmap)
 
 FlatMap (const FlatMap &flatmap, size_t capacity)
 
 FlatMap (FlatMap &&) noexcept=default
 
 ~FlatMap ()=default
 
FlatMapoperator= (const FlatMap &flatmap)
 
FlatMapoperator= (FlatMap &&) noexcept=default
 
 operator bool () const noexcept
 Check if the flat map is not empty. More...
 
mapped_typeoperator[] (const TKey &key)
 Access to the item with the given key or insert a new one. More...
 
bool empty () const noexcept
 Is the flat map empty? More...
 
size_t capacity () const noexcept
 Get the flat map capacity. More...
 
size_t size () const noexcept
 Get the flat map size. More...
 
size_t max_size () const noexcept
 Get the flat map maximum size. More...
 
bool compare (const TKey &key1, const TKey &key2) const noexcept
 Compare two items: if the first key is less than the second one? More...
 
bool compare (const TKey &key1, const value_type &key2) const noexcept
 
bool compare (const value_type &key1, const TKey &key2) const noexcept
 
bool compare (const value_type &key1, const value_type &key2) const noexcept
 
iterator begin () noexcept
 Get the begin flat map iterator. More...
 
const_iterator begin () const noexcept
 
const_iterator cbegin () const noexcept
 
iterator end () noexcept
 Get the end flat map iterator. More...
 
const_iterator end () const noexcept
 
const_iterator cend () const noexcept
 
reverse_iterator rbegin () noexcept
 Get the reverse begin flat map iterator. More...
 
const_reverse_iterator rbegin () const noexcept
 
const_reverse_iterator crbegin () const noexcept
 
reverse_iterator rend () noexcept
 Get the reverse end flat map iterator. More...
 
const_reverse_iterator rend () const noexcept
 
const_reverse_iterator crend () const noexcept
 
iterator find (const TKey &key) noexcept
 Find the iterator which points to the first item with the given key in the flat map or return end iterator. More...
 
const_iterator find (const TKey &key) const noexcept
 
iterator lower_bound (const TKey &key) noexcept
 Find the iterator which points to the first item with the given key that not less than the given key in the flat map or return end iterator. More...
 
const_iterator lower_bound (const TKey &key) const noexcept
 
iterator upper_bound (const TKey &key) noexcept
 Find the iterator which points to the first item with the given key that greater than the given key in the flat map or return end iterator. More...
 
const_iterator upper_bound (const TKey &key) const noexcept
 
std::pair< iterator, iteratorequal_range (const TKey &key) noexcept
 Find the bounds of a range that includes all the elements in the hash map with the given key. More...
 
std::pair< const_iterator, const_iteratorequal_range (const TKey &key) const noexcept
 
size_t count (const TKey &key) const noexcept
 Find the count of items with the given key. More...
 
mapped_typeat (const TKey &key) noexcept
 Access to the item with the given key or throw std::out_of_range exception. More...
 
const mapped_typeat (const TKey &key) const noexcept
 Access to the constant item with the given key or throw std::out_of_range exception. More...
 
std::pair< iterator, bool > insert (const value_type &item)
 Insert a new item into the flat map. More...
 
std::pair< iterator, bool > insert (value_type &&item)
 Insert a new item into the flat map. More...
 
iterator insert (const const_iterator &position, const value_type &item)
 Insert a new item into the flat map with a position hint. More...
 
iterator insert (const const_iterator &position, value_type &&item)
 Insert a new item into the flat map with a position hint. More...
 
template<class InputIterator >
void insert (InputIterator first, InputIterator last)
 Insert all items into the flat map from the given iterators range. More...
 
template<typename... Args>
std::pair< iterator, bool > emplace (Args &&... args)
 Emplace a new item into the flat map. More...
 
template<typename... Args>
iterator emplace_hint (const const_iterator &position, Args &&... args)
 Emplace a new item into the flat map with a position hint. More...
 
size_t erase (const TKey &key)
 Erase the item with the given key from the flat map. More...
 
iterator erase (const const_iterator &position)
 Erase the item by its iterator from the flat map. More...
 
iterator erase (const const_iterator &first, const const_iterator &last)
 Erase all items between two given iterators from the flat map. More...
 
void reserve (size_t count)
 Reserve the flat map capacity to fit the given count of items. More...
 
void shrink_to_fit ()
 Requests the flat map to reduce its capacity to fit its size. More...
 
void clear () noexcept
 Clear the flat map. More...
 
void swap (FlatMap &flatmap) noexcept
 Swap two instances. More...
 
template<typename... Args>
std::pair< typename FlatMap< TKey, TValue, TCompare, TAllocator >::iterator, bool > emplace (Args &&... args)
 
template<typename... Args>
std::pair< typename FlatMap< TKey, TValue, TCompare, TAllocator >::iterator, bool > emplace_internal (const TKey &key, Args &&... args)
 

Friends

template<typename UKey , typename UValue , typename UCompare , typename UAllocator >
void swap (FlatMap< UKey, UValue, UCompare, UAllocator > &flatmap1, FlatMap< UKey, UValue, UCompare, UAllocator > &flatmap2) noexcept
 

Detailed Description

template<typename TKey, typename TValue, typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
class CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >

Flat map container.

Flat map is an efficient structure for associative keys/value storing and accessing with keeping order. All key/value items are stored in the sorted array container with using binary search algorithm to find the item by the given key.

Not thread-safe.

Examples
containers_flatmap.cpp.

Definition at line 32 of file flatmap.h.

Member Typedef Documentation

◆ const_iterator

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
typedef std::vector<value_type, TAllocator>::const_iterator CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::const_iterator

Definition at line 46 of file flatmap.h.

◆ const_pointer

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
typedef const value_type* CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::const_pointer

Definition at line 42 of file flatmap.h.

◆ const_reference

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
typedef const value_type& CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::const_reference

Definition at line 40 of file flatmap.h.

◆ const_reverse_iterator

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
typedef std::vector<value_type, TAllocator>::const_reverse_iterator CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::const_reverse_iterator

Definition at line 48 of file flatmap.h.

◆ difference_type

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
typedef ptrdiff_t CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::difference_type

Definition at line 43 of file flatmap.h.

◆ iterator

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
typedef std::vector<value_type, TAllocator>::iterator CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::iterator

Definition at line 45 of file flatmap.h.

◆ key_type

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
typedef TKey CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::key_type

Definition at line 36 of file flatmap.h.

◆ mapped_type

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
typedef TValue CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::mapped_type

Definition at line 37 of file flatmap.h.

◆ pointer

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
typedef value_type* CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::pointer

Definition at line 41 of file flatmap.h.

◆ reference

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
typedef value_type& CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::reference

Definition at line 39 of file flatmap.h.

◆ reverse_iterator

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
typedef std::vector<value_type, TAllocator>::reverse_iterator CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::reverse_iterator

Definition at line 47 of file flatmap.h.

◆ size_type

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
typedef size_t CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::size_type

Definition at line 44 of file flatmap.h.

◆ value_type

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
typedef std::pair<TKey, TValue> CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::value_type

Definition at line 38 of file flatmap.h.

Constructor & Destructor Documentation

◆ FlatMap() [1/5]

template<typename TKey , typename TValue , typename TCompare , typename TAllocator >
CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::FlatMap ( size_t  capacity = 128,
const TCompare &  compare = TCompare(),
const TAllocator &  allocator = TAllocator() 
)
inlineexplicit

Initialize the flat map with a given capacity.

Parameters
capacity- Flat map capacity (default is 128)
compare- Key comparator (default is TCompare())
allocator- Allocator (default is TAllocator())

Definition at line 12 of file flatmap.inl.

◆ FlatMap() [2/5]

template<typename TKey , typename TValue , typename TCompare , typename TAllocator >
template<class InputIterator >
CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::FlatMap ( InputIterator  first,
InputIterator  last,
bool  unused,
size_t  capacity = 128,
const TCompare &  compare = TCompare(),
const TAllocator &  allocator = TAllocator() 
)
inline

Definition at line 20 of file flatmap.inl.

◆ FlatMap() [3/5]

template<typename TKey , typename TValue , typename TCompare , typename TAllocator >
CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::FlatMap ( const FlatMap< TKey, TValue, TCompare, TAllocator > &  flatmap)
inline

Definition at line 27 of file flatmap.inl.

◆ FlatMap() [4/5]

template<typename TKey , typename TValue , typename TCompare , typename TAllocator >
CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::FlatMap ( const FlatMap< TKey, TValue, TCompare, TAllocator > &  flatmap,
size_t  capacity 
)
inline

Definition at line 35 of file flatmap.inl.

◆ FlatMap() [5/5]

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::FlatMap ( FlatMap< TKey, TValue, TCompare, TAllocator > &&  )
defaultnoexcept

◆ ~FlatMap()

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::~FlatMap ( )
default

Member Function Documentation

◆ at() [1/2]

template<typename TKey , typename TValue , typename TCompare , typename TAllocator >
const FlatMap< TKey, TValue, TCompare, TAllocator >::mapped_type & CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::at ( const TKey &  key) const
inlinenoexcept

Access to the constant item with the given key or throw std::out_of_range exception.

Parameters
key- Key of the item
Returns
Constant item with the given key

Definition at line 117 of file flatmap.inl.

◆ at() [2/2]

template<typename TKey , typename TValue , typename TCompare , typename TAllocator >
FlatMap< TKey, TValue, TCompare, TAllocator >::mapped_type & CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::at ( const TKey &  key)
inlinenoexcept

Access to the item with the given key or throw std::out_of_range exception.

Parameters
key- Key of the item
Returns
Item with the given key

Definition at line 107 of file flatmap.inl.

◆ begin() [1/2]

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
const_iterator CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::begin ( ) const
inlinenoexcept

Definition at line 91 of file flatmap.h.

◆ begin() [2/2]

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
iterator CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::begin ( )
inlinenoexcept

Get the begin flat map iterator.

Definition at line 90 of file flatmap.h.

◆ capacity()

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
size_t CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::capacity ( ) const
inlinenoexcept

Get the flat map capacity.

Definition at line 77 of file flatmap.h.

◆ cbegin()

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
const_iterator CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::cbegin ( ) const
inlinenoexcept

Definition at line 92 of file flatmap.h.

◆ cend()

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
const_iterator CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::cend ( ) const
inlinenoexcept

Definition at line 96 of file flatmap.h.

◆ clear()

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
void CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::clear ( )
inlinenoexcept

Clear the flat map.

Definition at line 220 of file flatmap.h.

◆ compare() [1/4]

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
bool CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::compare ( const TKey &  key1,
const TKey &  key2 
) const
inlinenoexcept

Compare two items: if the first key is less than the second one?

Definition at line 84 of file flatmap.h.

◆ compare() [2/4]

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
bool CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::compare ( const TKey &  key1,
const value_type key2 
) const
inlinenoexcept

Definition at line 85 of file flatmap.h.

◆ compare() [3/4]

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
bool CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::compare ( const value_type key1,
const TKey &  key2 
) const
inlinenoexcept

Definition at line 86 of file flatmap.h.

◆ compare() [4/4]

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
bool CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::compare ( const value_type key1,
const value_type key2 
) const
inlinenoexcept

Definition at line 87 of file flatmap.h.

◆ count()

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
size_t CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::count ( const TKey &  key) const
inlinenoexcept

Find the count of items with the given key.

Definition at line 123 of file flatmap.h.

◆ crbegin()

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
const_reverse_iterator CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::crbegin ( ) const
inlinenoexcept

Definition at line 101 of file flatmap.h.

◆ crend()

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
const_reverse_iterator CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::crend ( ) const
inlinenoexcept

Definition at line 105 of file flatmap.h.

◆ emplace() [1/2]

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
template<typename... Args>
std::pair<iterator, bool> CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::emplace ( Args &&...  args)

Emplace a new item into the flat map.

Parameters
args- Arguments to emplace
Returns
Pair with the iterator to the given key and success flag

◆ emplace() [2/2]

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
template<typename... Args>
std::pair<typename FlatMap<TKey, TValue, TCompare, TAllocator>::iterator, bool> CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::emplace ( Args &&...  args)
inline

Definition at line 160 of file flatmap.inl.

◆ emplace_hint()

template<typename TKey , typename TValue , typename TCompare , typename TAllocator >
template<typename... Args>
FlatMap< TKey, TValue, TCompare, TAllocator >::iterator CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::emplace_hint ( const const_iterator position,
Args &&...  args 
)
inline

Emplace a new item into the flat map with a position hint.

Parameters
position- Iterator position to the emplaced item
args- Arguments to emplace
Returns
Iterator to the given key

Definition at line 167 of file flatmap.inl.

◆ emplace_internal()

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
template<typename... Args>
std::pair<typename FlatMap<TKey, TValue, TCompare, TAllocator>::iterator, bool> CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::emplace_internal ( const TKey &  key,
Args &&...  args 
)
inline

Definition at line 202 of file flatmap.inl.

◆ empty()

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
bool CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::empty ( ) const
inlinenoexcept

Is the flat map empty?

Definition at line 74 of file flatmap.h.

◆ end() [1/2]

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
const_iterator CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::end ( ) const
inlinenoexcept

Definition at line 95 of file flatmap.h.

◆ end() [2/2]

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
iterator CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::end ( )
inlinenoexcept

Get the end flat map iterator.

Definition at line 94 of file flatmap.h.

◆ equal_range() [1/2]

template<typename TKey , typename TValue , typename TCompare , typename TAllocator >
std::pair< typename FlatMap< TKey, TValue, TCompare, TAllocator >::const_iterator, typename FlatMap< TKey, TValue, TCompare, TAllocator >::const_iterator > CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::equal_range ( const TKey &  key) const
inlinenoexcept

Definition at line 101 of file flatmap.inl.

◆ equal_range() [2/2]

template<typename TKey , typename TValue , typename TCompare , typename TAllocator >
std::pair< typename FlatMap< TKey, TValue, TCompare, TAllocator >::iterator, typename FlatMap< TKey, TValue, TCompare, TAllocator >::iterator > CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::equal_range ( const TKey &  key)
inlinenoexcept

Find the bounds of a range that includes all the elements in the hash map with the given key.

Definition at line 95 of file flatmap.inl.

◆ erase() [1/3]

template<typename TKey , typename TValue , typename TCompare , typename TAllocator >
FlatMap< TKey, TValue, TCompare, TAllocator >::iterator CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::erase ( const const_iterator first,
const const_iterator last 
)
inline

Erase all items between two given iterators from the flat map.

Parameters
first- The first iterator of the erased range
last- The last iterator of the erased range
Returns
Iterator pointing to the position immediately following the last of the elements erased

Definition at line 193 of file flatmap.inl.

◆ erase() [2/3]

template<typename TKey , typename TValue , typename TCompare , typename TAllocator >
FlatMap< TKey, TValue, TCompare, TAllocator >::iterator CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::erase ( const const_iterator position)
inline

Erase the item by its iterator from the flat map.

Parameters
position- Iterator position to the erased item
Returns
Iterator pointing to the position immediately following the last of the elements erased

Definition at line 184 of file flatmap.inl.

◆ erase() [3/3]

template<typename TKey , typename TValue , typename TCompare , typename TAllocator >
size_t CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::erase ( const TKey &  key)
inline

Erase the item with the given key from the flat map.

Parameters
key- Key of the item to erase
Returns
Number of erased elements (0 or 1 for the hash map)

Definition at line 173 of file flatmap.inl.

◆ find() [1/2]

template<typename TKey , typename TValue , typename TCompare , typename TAllocator >
FlatMap< TKey, TValue, TCompare, TAllocator >::const_iterator CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::find ( const TKey &  key) const
inlinenoexcept

Definition at line 62 of file flatmap.inl.

◆ find() [2/2]

template<typename TKey , typename TValue , typename TCompare , typename TAllocator >
FlatMap< TKey, TValue, TCompare, TAllocator >::iterator CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::find ( const TKey &  key)
inlinenoexcept

Find the iterator which points to the first item with the given key in the flat map or return end iterator.

Definition at line 53 of file flatmap.inl.

◆ insert() [1/5]

template<typename TKey , typename TValue , typename TCompare , typename TAllocator >
FlatMap< TKey, TValue, TCompare, TAllocator >::iterator CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::insert ( const const_iterator position,
const value_type item 
)
inline

Insert a new item into the flat map with a position hint.

Parameters
position- Iterator position to the inserted item
item- Item to insert as a key/value pair
Returns
Iterator to the given key

Definition at line 139 of file flatmap.inl.

◆ insert() [2/5]

template<typename TKey , typename TValue , typename TCompare , typename TAllocator >
FlatMap< TKey, TValue, TCompare, TAllocator >::iterator CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::insert ( const const_iterator position,
value_type &&  item 
)
inline

Insert a new item into the flat map with a position hint.

Parameters
position- Iterator position to the inserted item
item- Item to insert as a key/value pair
Returns
Iterator to the given key

Definition at line 145 of file flatmap.inl.

◆ insert() [3/5]

template<typename TKey , typename TValue , typename TCompare , typename TAllocator >
std::pair< typename FlatMap< TKey, TValue, TCompare, TAllocator >::iterator, bool > CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::insert ( const value_type item)
inline

Insert a new item into the flat map.

Parameters
item- Item to insert as a key/value pair
Returns
Pair with the iterator to the given key and success flag

Definition at line 127 of file flatmap.inl.

◆ insert() [4/5]

template<typename TKey , typename TValue , typename TCompare , typename TAllocator >
template<class InputIterator >
void CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::insert ( InputIterator  first,
InputIterator  last 
)
inline

Insert all items into the flat map from the given iterators range.

Parameters
first- The first iterator of the inserted range
last- The last iterator of the inserted range

Definition at line 152 of file flatmap.inl.

◆ insert() [5/5]

template<typename TKey , typename TValue , typename TCompare , typename TAllocator >
std::pair< typename FlatMap< TKey, TValue, TCompare, TAllocator >::iterator, bool > CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::insert ( value_type &&  item)
inline

Insert a new item into the flat map.

Parameters
item- Item to insert as a key/value pair
Returns
Pair with the iterator to the given key and success flag

Definition at line 133 of file flatmap.inl.

◆ lower_bound() [1/2]

template<typename TKey , typename TValue , typename TCompare , typename TAllocator >
FlatMap< TKey, TValue, TCompare, TAllocator >::const_iterator CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::lower_bound ( const TKey &  key) const
inlinenoexcept

Definition at line 77 of file flatmap.inl.

◆ lower_bound() [2/2]

template<typename TKey , typename TValue , typename TCompare , typename TAllocator >
FlatMap< TKey, TValue, TCompare, TAllocator >::iterator CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::lower_bound ( const TKey &  key)
inlinenoexcept

Find the iterator which points to the first item with the given key that not less than the given key in the flat map or return end iterator.

Definition at line 71 of file flatmap.inl.

◆ max_size()

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
size_t CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::max_size ( ) const
inlinenoexcept

Get the flat map maximum size.

Definition at line 81 of file flatmap.h.

◆ operator bool()

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::operator bool ( ) const
inlineexplicitnoexcept

Check if the flat map is not empty.

Definition at line 68 of file flatmap.h.

◆ operator=() [1/2]

template<typename TKey , typename TValue , typename TCompare , typename TAllocator >
FlatMap< TKey, TValue, TCompare, TAllocator > & CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::operator= ( const FlatMap< TKey, TValue, TCompare, TAllocator > &  flatmap)
inline

Definition at line 43 of file flatmap.inl.

◆ operator=() [2/2]

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
FlatMap& CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::operator= ( FlatMap< TKey, TValue, TCompare, TAllocator > &&  )
defaultnoexcept

◆ operator[]()

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
mapped_type& CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::operator[] ( const TKey &  key)
inline

Access to the item with the given key or insert a new one.

Definition at line 71 of file flatmap.h.

◆ rbegin() [1/2]

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
const_reverse_iterator CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::rbegin ( ) const
inlinenoexcept

Definition at line 100 of file flatmap.h.

◆ rbegin() [2/2]

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
reverse_iterator CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::rbegin ( )
inlinenoexcept

Get the reverse begin flat map iterator.

Definition at line 99 of file flatmap.h.

◆ rend() [1/2]

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
const_reverse_iterator CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::rend ( ) const
inlinenoexcept

Definition at line 104 of file flatmap.h.

◆ rend() [2/2]

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
reverse_iterator CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::rend ( )
inlinenoexcept

Get the reverse end flat map iterator.

Definition at line 103 of file flatmap.h.

◆ reserve()

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
void CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::reserve ( size_t  count)
inline

Reserve the flat map capacity to fit the given count of items.

Parameters
count- Count of items to fit

Definition at line 212 of file flatmap.h.

◆ shrink_to_fit()

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
void CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::shrink_to_fit ( )
inline

Requests the flat map to reduce its capacity to fit its size.

This may cause a reallocation, but has no effect on the vector size and cannot alter its elements.

Definition at line 217 of file flatmap.h.

◆ size()

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
size_t CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::size ( ) const
inlinenoexcept

Get the flat map size.

Definition at line 79 of file flatmap.h.

◆ swap()

template<typename TKey , typename TValue , typename TCompare , typename TAllocator >
void CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::swap ( FlatMap< TKey, TValue, TCompare, TAllocator > &  flatmap)
inlinenoexcept

Swap two instances.

Definition at line 224 of file flatmap.inl.

◆ upper_bound() [1/2]

template<typename TKey , typename TValue , typename TCompare , typename TAllocator >
FlatMap< TKey, TValue, TCompare, TAllocator >::const_iterator CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::upper_bound ( const TKey &  key) const
inlinenoexcept

Definition at line 89 of file flatmap.inl.

◆ upper_bound() [2/2]

template<typename TKey , typename TValue , typename TCompare , typename TAllocator >
FlatMap< TKey, TValue, TCompare, TAllocator >::iterator CppCommon::FlatMap< TKey, TValue, TCompare, TAllocator >::upper_bound ( const TKey &  key)
inlinenoexcept

Find the iterator which points to the first item with the given key that greater than the given key in the flat map or return end iterator.

Definition at line 83 of file flatmap.inl.

Friends And Related Function Documentation

◆ swap

template<typename TKey , typename TValue , typename TCompare = std::less<TKey>, typename TAllocator = std::allocator<std::pair<TKey, TValue>>>
template<typename UKey , typename UValue , typename UCompare , typename UAllocator >
void swap ( FlatMap< UKey, UValue, UCompare, UAllocator > &  flatmap1,
FlatMap< UKey, UValue, UCompare, UAllocator > &  flatmap2 
)
friend

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