Molassembler  3.0.0
Molecule graph and conformer library
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Scine::Molassembler::Temple::DynamicMap< KeyType, MappedType, N > Class Template Reference

A constexpr associative container with reasonably fast key-based lookup. More...

#include <DynamicMap.h>

Data Structures

struct  OnlyFirstComparator
 
struct  OnlyFirstEquality
 

Public Member Functions

Special member functions
constexpr DynamicMap ()=default
 
constexpr DynamicMap (DynamicMap &&other) noexcept
 
constexpr DynamicMap (const DynamicMap &other)
 
constexpr DynamicMapoperator= (const DynamicMap &other)
 
constexpr DynamicMapoperator= (DynamicMap &&other) noexcept
 
Modification
constexpr void insert (KeyType key, MappedType item)
 Inserts an element into the map. More...
 
constexpr void insertOrUpdate (KeyType key, MappedType item)
 Inserts a key-value pair into the map or updates the mapped value if the key exists. More...
 
constexpr void clear ()
 Inserts an element into the map. More...
 
Information
constexpr const MappedType & at (const KeyType &key) const
 Value lookup. More...
 
constexpr unsigned size () const
 Number of items in the map. More...
 
Operators
constexpr bool operator== (const DynamicMap &other) const
 
constexpr bool operator!= (const DynamicMap &other) const
 
constexpr bool operator< (const DynamicMap &other) const
 
constexpr bool operator> (const DynamicMap &other) const
 

Private Types

using PairType = Pair< KeyType, MappedType >
 
using SetType = DynamicSet< PairType, N, OnlyFirstComparator, OnlyFirstEquality >
 

Private Attributes

SetType items_
 

Iterators

using const_iterator = typename SetType::const_iterator
 
constexpr const_iterator begin () const
 
constexpr const_iterator end () const
 

Detailed Description

template<typename KeyType, typename MappedType, size_t N>
class Scine::Molassembler::Temple::DynamicMap< KeyType, MappedType, N >

A constexpr associative container with reasonably fast key-based lookup.

Requires that MappedType is default-constructible

Template Parameters
KeyTypeType of the key in the map
MappedTypeValue type of the map
NMaximum number of elements in the map

Member Function Documentation

template<typename KeyType , typename MappedType , size_t N>
constexpr const MappedType& Scine::Molassembler::Temple::DynamicMap< KeyType, MappedType, N >::at ( const KeyType &  key) const
inline

Value lookup.

Complexity \(\Theta(N \log N)\)

template<typename KeyType , typename MappedType , size_t N>
constexpr void Scine::Molassembler::Temple::DynamicMap< KeyType, MappedType, N >::clear ( )
inline

Inserts an element into the map.

Complexity \(\Theta(N \log N)\)

template<typename KeyType , typename MappedType , size_t N>
constexpr void Scine::Molassembler::Temple::DynamicMap< KeyType, MappedType, N >::insert ( KeyType  key,
MappedType  item 
)
inline

Inserts an element into the map.

Complexity \(\Theta(N \log N)\)

template<typename KeyType , typename MappedType , size_t N>
constexpr void Scine::Molassembler::Temple::DynamicMap< KeyType, MappedType, N >::insertOrUpdate ( KeyType  key,
MappedType  item 
)
inline

Inserts a key-value pair into the map or updates the mapped value if the key exists.

Complexity \(\Theta(N \log N)\)

template<typename KeyType , typename MappedType , size_t N>
constexpr unsigned Scine::Molassembler::Temple::DynamicMap< KeyType, MappedType, N >::size ( ) const
inline

Number of items in the map.

Complexity \(\Theta(1)\)


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