momo  3.9
momo::stdish::multimap< TKey, TMapped, TLessFunc, TAllocator, TTreeMap > Class Template Reference

momo::stdish::multimap is similar to std::multimap, but much more efficient in memory usage. The implementation is based on a B-tree. More...

#include <map.h>

Inheritance diagram for momo::stdish::multimap< TKey, TMapped, TLessFunc, TAllocator, TTreeMap >:

Public Types

typedef iterator insert_return_type
 
typedef TKey key_type
 
typedef TMapped mapped_type
 
typedef size_t size_type
 
typedef std::pair< const key_type, mapped_typevalue_type
 
typedef momo::internal::TreeDerivedIterator< TreeMapIterator, momo::internal::MapReferenceStditerator
 
typedef const_iterator::Reference const_reference
 
typedef iterator::ConstIterator const_iterator
 
typedef internal::map_node_handle< typename TreeMap::ExtractedPairnode_type
 

Public Member Functions

multimapoperator= (std::initializer_list< value_type > values)
 
iterator insert (std::pair< key_type, mapped_type > &&value)
 
iterator insert (const_iterator hint, std::pair< key_type, mapped_type > &&value)
 
template<typename First , typename Second >
momo::internal::EnableIf< std::is_constructible< key_type, const First & >::value &&std::is_constructible< mapped_type, const Second & >::value, iteratorinsert (const std::pair< First, Second > &value)
 
template<typename First , typename Second >
momo::internal::EnableIf< std::is_constructible< key_type, const First & >::value &&std::is_constructible< mapped_type, const Second & >::value, iteratorinsert (const_iterator hint, const std::pair< First, Second > &value)
 
template<typename First , typename Second >
momo::internal::EnableIf< std::is_constructible< key_type, First && >::value &&std::is_constructible< mapped_type, Second && >::value, iteratorinsert (std::pair< First, Second > &&value)
 
template<typename First , typename Second >
momo::internal::EnableIf< std::is_constructible< key_type, First && >::value &&std::is_constructible< mapped_type, Second && >::value, iteratorinsert (const_iterator hint, std::pair< First, Second > &&value)
 
iterator insert (node_type &&node)
 
iterator insert (const_iterator hint, node_type &&node)
 
template<typename Iterator >
void insert (Iterator first, Iterator last)
 
void insert (std::initializer_list< value_type > values)
 
template<typename... ValueArgs>
iterator emplace (ValueArgs &&... valueArgs)
 

Friends

void swap (multimap &left, multimap &right) noexcept
 
template<typename ValueFilter >
size_type erase_if (multimap &cont, const ValueFilter &valueFilter)
 

Detailed Description

template<typename TKey, typename TMapped, typename TLessFunc = std::less<TKey>, typename TAllocator = std::allocator<std::pair<const TKey, TMapped>>, typename TTreeMap = TreeMap<TKey, TMapped, TreeTraitsStd<TKey, TLessFunc, true>, MemManagerStd<TAllocator>>>
class momo::stdish::multimap< TKey, TMapped, TLessFunc, TAllocator, TTreeMap >

momo::stdish::multimap is similar to std::multimap, but much more efficient in memory usage. The implementation is based on a B-tree.

Deviations from standard class:

  1. Container items must be movable (preferably without exceptions) or copyable, similar to items of std::vector.
  2. After each addition or removal of the item all iterators and references to items become invalid and should not be used.
  3. Type reference is not the same as value_type&, so for (auto& p : map) is illegal, but for (auto p : map) or for (const auto& p : map) or for (auto&& p : map) is allowed.
  4. Functions begin, cbegin, rend and crend have logarithmic complexity.
  5. If ObjectManager<key_type>::isNothrowAnywayAssignable is false or ObjectManager<mapped_type>::isNothrowAnywayAssignable is false, functions erase can throw exceptions.
  6. Functions merge, extract and insert(node_type&&) move items.

It is allowed to pass to functions insert and emplace references to items within the container.

Function merge can work fast, if container types are same and each key from one container is less than each key from other container.

Member Typedef Documentation

◆ const_iterator

template<typename TKey , typename TMapped , typename TLessFunc = std::less<TKey>, typename TAllocator = std::allocator<std::pair<const TKey, TMapped>>, typename TTreeMap = TreeMap<TKey, TMapped, TreeTraitsStd<TKey, TLessFunc, true>, MemManagerStd<TAllocator>>>
typedef iterator::ConstIterator momo::stdish::internal::map_base< TKey, TMapped, TLessFunc, TAllocator, TTreeMap >::const_iterator

◆ const_reference

template<typename TKey , typename TMapped , typename TLessFunc = std::less<TKey>, typename TAllocator = std::allocator<std::pair<const TKey, TMapped>>, typename TTreeMap = TreeMap<TKey, TMapped, TreeTraitsStd<TKey, TLessFunc, true>, MemManagerStd<TAllocator>>>
typedef const_iterator::Reference momo::stdish::internal::map_base< TKey, TMapped, TLessFunc, TAllocator, TTreeMap >::const_reference

◆ insert_return_type

template<typename TKey , typename TMapped , typename TLessFunc = std::less<TKey>, typename TAllocator = std::allocator<std::pair<const TKey, TMapped>>, typename TTreeMap = TreeMap<TKey, TMapped, TreeTraitsStd<TKey, TLessFunc, true>, MemManagerStd<TAllocator>>>
typedef iterator momo::stdish::multimap< TKey, TMapped, TLessFunc, TAllocator, TTreeMap >::insert_return_type

◆ iterator

template<typename TKey , typename TMapped , typename TLessFunc = std::less<TKey>, typename TAllocator = std::allocator<std::pair<const TKey, TMapped>>, typename TTreeMap = TreeMap<TKey, TMapped, TreeTraitsStd<TKey, TLessFunc, true>, MemManagerStd<TAllocator>>>
typedef momo::internal::TreeDerivedIterator<TreeMapIterator, momo::internal::MapReferenceStd> momo::stdish::internal::map_base< TKey, TMapped, TLessFunc, TAllocator, TTreeMap >::iterator

◆ key_type

template<typename TKey , typename TMapped , typename TLessFunc = std::less<TKey>, typename TAllocator = std::allocator<std::pair<const TKey, TMapped>>, typename TTreeMap = TreeMap<TKey, TMapped, TreeTraitsStd<TKey, TLessFunc, true>, MemManagerStd<TAllocator>>>
typedef TKey momo::stdish::internal::map_base< TKey, TMapped, TLessFunc, TAllocator, TTreeMap >::key_type

◆ mapped_type

template<typename TKey , typename TMapped , typename TLessFunc = std::less<TKey>, typename TAllocator = std::allocator<std::pair<const TKey, TMapped>>, typename TTreeMap = TreeMap<TKey, TMapped, TreeTraitsStd<TKey, TLessFunc, true>, MemManagerStd<TAllocator>>>
typedef TMapped momo::stdish::internal::map_base< TKey, TMapped, TLessFunc, TAllocator, TTreeMap >::mapped_type

◆ node_type

template<typename TKey , typename TMapped , typename TLessFunc = std::less<TKey>, typename TAllocator = std::allocator<std::pair<const TKey, TMapped>>, typename TTreeMap = TreeMap<TKey, TMapped, TreeTraitsStd<TKey, TLessFunc, true>, MemManagerStd<TAllocator>>>
typedef internal::map_node_handle<typename TreeMap::ExtractedPair> momo::stdish::internal::map_base< TKey, TMapped, TLessFunc, TAllocator, TTreeMap >::node_type

◆ size_type

template<typename TKey , typename TMapped , typename TLessFunc = std::less<TKey>, typename TAllocator = std::allocator<std::pair<const TKey, TMapped>>, typename TTreeMap = TreeMap<TKey, TMapped, TreeTraitsStd<TKey, TLessFunc, true>, MemManagerStd<TAllocator>>>
typedef size_t momo::stdish::internal::map_base< TKey, TMapped, TLessFunc, TAllocator, TTreeMap >::size_type

◆ value_type

template<typename TKey , typename TMapped , typename TLessFunc = std::less<TKey>, typename TAllocator = std::allocator<std::pair<const TKey, TMapped>>, typename TTreeMap = TreeMap<TKey, TMapped, TreeTraitsStd<TKey, TLessFunc, true>, MemManagerStd<TAllocator>>>
typedef std::pair<const key_type, mapped_type> momo::stdish::internal::map_base< TKey, TMapped, TLessFunc, TAllocator, TTreeMap >::value_type

Member Function Documentation

◆ emplace()

template<typename TKey , typename TMapped , typename TLessFunc = std::less<TKey>, typename TAllocator = std::allocator<std::pair<const TKey, TMapped>>, typename TTreeMap = TreeMap<TKey, TMapped, TreeTraitsStd<TKey, TLessFunc, true>, MemManagerStd<TAllocator>>>
template<typename... ValueArgs>
iterator momo::stdish::multimap< TKey, TMapped, TLessFunc, TAllocator, TTreeMap >::emplace ( ValueArgs &&...  valueArgs)
inline

◆ insert() [1/10]

template<typename TKey , typename TMapped , typename TLessFunc = std::less<TKey>, typename TAllocator = std::allocator<std::pair<const TKey, TMapped>>, typename TTreeMap = TreeMap<TKey, TMapped, TreeTraitsStd<TKey, TLessFunc, true>, MemManagerStd<TAllocator>>>
template<typename First , typename Second >
momo::internal::EnableIf<std::is_constructible<key_type, const First&>::value && std::is_constructible<mapped_type, const Second&>::value, iterator> momo::stdish::multimap< TKey, TMapped, TLessFunc, TAllocator, TTreeMap >::insert ( const std::pair< First, Second > &  value)
inline

◆ insert() [2/10]

template<typename TKey , typename TMapped , typename TLessFunc = std::less<TKey>, typename TAllocator = std::allocator<std::pair<const TKey, TMapped>>, typename TTreeMap = TreeMap<TKey, TMapped, TreeTraitsStd<TKey, TLessFunc, true>, MemManagerStd<TAllocator>>>
template<typename First , typename Second >
momo::internal::EnableIf<std::is_constructible<key_type, const First&>::value && std::is_constructible<mapped_type, const Second&>::value, iterator> momo::stdish::multimap< TKey, TMapped, TLessFunc, TAllocator, TTreeMap >::insert ( const_iterator  hint,
const std::pair< First, Second > &  value 
)
inline

◆ insert() [3/10]

template<typename TKey , typename TMapped , typename TLessFunc = std::less<TKey>, typename TAllocator = std::allocator<std::pair<const TKey, TMapped>>, typename TTreeMap = TreeMap<TKey, TMapped, TreeTraitsStd<TKey, TLessFunc, true>, MemManagerStd<TAllocator>>>
iterator momo::stdish::multimap< TKey, TMapped, TLessFunc, TAllocator, TTreeMap >::insert ( const_iterator  hint,
node_type &&  node 
)
inline

◆ insert() [4/10]

template<typename TKey , typename TMapped , typename TLessFunc = std::less<TKey>, typename TAllocator = std::allocator<std::pair<const TKey, TMapped>>, typename TTreeMap = TreeMap<TKey, TMapped, TreeTraitsStd<TKey, TLessFunc, true>, MemManagerStd<TAllocator>>>
template<typename First , typename Second >
momo::internal::EnableIf<std::is_constructible<key_type, First&&>::value && std::is_constructible<mapped_type, Second&&>::value, iterator> momo::stdish::multimap< TKey, TMapped, TLessFunc, TAllocator, TTreeMap >::insert ( const_iterator  hint,
std::pair< First, Second > &&  value 
)
inline

◆ insert() [5/10]

template<typename TKey , typename TMapped , typename TLessFunc = std::less<TKey>, typename TAllocator = std::allocator<std::pair<const TKey, TMapped>>, typename TTreeMap = TreeMap<TKey, TMapped, TreeTraitsStd<TKey, TLessFunc, true>, MemManagerStd<TAllocator>>>
iterator momo::stdish::multimap< TKey, TMapped, TLessFunc, TAllocator, TTreeMap >::insert ( const_iterator  hint,
std::pair< key_type, mapped_type > &&  value 
)
inline

◆ insert() [6/10]

template<typename TKey , typename TMapped , typename TLessFunc = std::less<TKey>, typename TAllocator = std::allocator<std::pair<const TKey, TMapped>>, typename TTreeMap = TreeMap<TKey, TMapped, TreeTraitsStd<TKey, TLessFunc, true>, MemManagerStd<TAllocator>>>
template<typename Iterator >
void momo::stdish::multimap< TKey, TMapped, TLessFunc, TAllocator, TTreeMap >::insert ( Iterator  first,
Iterator  last 
)
inline

◆ insert() [7/10]

template<typename TKey , typename TMapped , typename TLessFunc = std::less<TKey>, typename TAllocator = std::allocator<std::pair<const TKey, TMapped>>, typename TTreeMap = TreeMap<TKey, TMapped, TreeTraitsStd<TKey, TLessFunc, true>, MemManagerStd<TAllocator>>>
iterator momo::stdish::multimap< TKey, TMapped, TLessFunc, TAllocator, TTreeMap >::insert ( node_type &&  node)
inline

◆ insert() [8/10]

template<typename TKey , typename TMapped , typename TLessFunc = std::less<TKey>, typename TAllocator = std::allocator<std::pair<const TKey, TMapped>>, typename TTreeMap = TreeMap<TKey, TMapped, TreeTraitsStd<TKey, TLessFunc, true>, MemManagerStd<TAllocator>>>
void momo::stdish::multimap< TKey, TMapped, TLessFunc, TAllocator, TTreeMap >::insert ( std::initializer_list< value_type values)
inline

◆ insert() [9/10]

template<typename TKey , typename TMapped , typename TLessFunc = std::less<TKey>, typename TAllocator = std::allocator<std::pair<const TKey, TMapped>>, typename TTreeMap = TreeMap<TKey, TMapped, TreeTraitsStd<TKey, TLessFunc, true>, MemManagerStd<TAllocator>>>
template<typename First , typename Second >
momo::internal::EnableIf<std::is_constructible<key_type, First&&>::value && std::is_constructible<mapped_type, Second&&>::value, iterator> momo::stdish::multimap< TKey, TMapped, TLessFunc, TAllocator, TTreeMap >::insert ( std::pair< First, Second > &&  value)
inline

◆ insert() [10/10]

template<typename TKey , typename TMapped , typename TLessFunc = std::less<TKey>, typename TAllocator = std::allocator<std::pair<const TKey, TMapped>>, typename TTreeMap = TreeMap<TKey, TMapped, TreeTraitsStd<TKey, TLessFunc, true>, MemManagerStd<TAllocator>>>
iterator momo::stdish::multimap< TKey, TMapped, TLessFunc, TAllocator, TTreeMap >::insert ( std::pair< key_type, mapped_type > &&  value)
inline

◆ operator=()

template<typename TKey , typename TMapped , typename TLessFunc = std::less<TKey>, typename TAllocator = std::allocator<std::pair<const TKey, TMapped>>, typename TTreeMap = TreeMap<TKey, TMapped, TreeTraitsStd<TKey, TLessFunc, true>, MemManagerStd<TAllocator>>>
multimap& momo::stdish::multimap< TKey, TMapped, TLessFunc, TAllocator, TTreeMap >::operator= ( std::initializer_list< value_type values)
inline

Friends And Related Function Documentation

◆ erase_if

template<typename TKey , typename TMapped , typename TLessFunc = std::less<TKey>, typename TAllocator = std::allocator<std::pair<const TKey, TMapped>>, typename TTreeMap = TreeMap<TKey, TMapped, TreeTraitsStd<TKey, TLessFunc, true>, MemManagerStd<TAllocator>>>
template<typename ValueFilter >
size_type erase_if ( multimap< TKey, TMapped, TLessFunc, TAllocator, TTreeMap > &  cont,
const ValueFilter &  valueFilter 
)
friend

◆ swap

template<typename TKey , typename TMapped , typename TLessFunc = std::less<TKey>, typename TAllocator = std::allocator<std::pair<const TKey, TMapped>>, typename TTreeMap = TreeMap<TKey, TMapped, TreeTraitsStd<TKey, TLessFunc, true>, MemManagerStd<TAllocator>>>
void swap ( multimap< TKey, TMapped, TLessFunc, TAllocator, TTreeMap > &  left,
multimap< TKey, TMapped, TLessFunc, TAllocator, TTreeMap > &  right 
)
friend

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