27 #ifndef CDPL_MATH_SPARSECONTAINERELEMENT_HPP
28 #define CDPL_MATH_SPARSECONTAINERELEMENT_HPP
50 template <
typename C,
typename K =
typename C::KeyType>
60 typedef typename ContainerType::ValueType
ValueType;
62 typedef typename ContainerType::SizeType
SizeType;
68 typedef typename ContainerType::ArrayType
ArrayType;
100 template <
typename D>
114 template <
typename D>
130 template <
typename D>
146 template <
typename D>
162 template <
typename D>
178 template <
typename D>
192 template <
typename D>
216 cntnr.getData().erase(key);
219 std::pair<typename ArrayType::iterator, bool> pos = cntnr.getData().insert(
typename ArrayType::value_type(key, v));
222 pos.first->second = v;
228 typename ArrayType::const_iterator it = cntnr.getData().find(key);
230 if (it == cntnr.getData().end())
245 template <
typename C>
Definition of various preprocessor macros for error checking.
Definition of type traits.
Proxy that exposes a single (key, value) entry of a sparse container as a writable reference.
Definition: SparseContainerElement.hpp:52
K KeyType
The key type used to address an entry of the container.
Definition: SparseContainerElement.hpp:58
SparseContainerElement & operator-=(const D &d)
Subtracts d from the value of the entry pointed to by this proxy.
Definition: SparseContainerElement.hpp:131
SparseContainerElement & operator/=(const D &d)
Divides the value of the entry pointed to by this proxy by d.
Definition: SparseContainerElement.hpp:163
ValueType & Reference
Mutable reference type to a value.
Definition: SparseContainerElement.hpp:64
ContainerType::SizeType SizeType
The size type used by the container.
Definition: SparseContainerElement.hpp:62
ContainerType::ValueType ValueType
The value type stored in the container.
Definition: SparseContainerElement.hpp:60
SparseContainerElement & operator=(const SparseContainerElement &p)
Copies the value pointed to by p into the entry pointed to by this proxy.
Definition: SparseContainerElement.hpp:83
SparseContainerElement(ContainerType &c, KeyType key)
Constructs the proxy for the (key, value) entry of the sparse container c.
Definition: SparseContainerElement.hpp:75
bool operator!=(const D &d) const
Tests the value of the entry pointed to by this proxy for inequality with d.
Definition: SparseContainerElement.hpp:193
bool operator==(const D &d) const
Tests the value of the entry pointed to by this proxy for equality with d.
Definition: SparseContainerElement.hpp:179
SparseContainerElement & operator=(const D &d)
Assigns the value d to the entry pointed to by this proxy.
Definition: SparseContainerElement.hpp:101
SparseContainerElement & operator+=(const D &d)
Adds d to the value of the entry pointed to by this proxy.
Definition: SparseContainerElement.hpp:115
SparseContainerElement & operator*=(const D &d)
Multiplies the value of the entry pointed to by this proxy by d.
Definition: SparseContainerElement.hpp:147
C ContainerType
The sparse container type the proxy references.
Definition: SparseContainerElement.hpp:56
ContainerType::ArrayType ArrayType
Underlying associative-array type of the container (typically a std::map / std::unordered_map special...
Definition: SparseContainerElement.hpp:68
ContainerType::ConstReference ConstReference
Constant reference type to a value (as defined by the container).
Definition: SparseContainerElement.hpp:66
constexpr unsigned int D
Specifies Hydrogen (Deuterium).
Definition: AtomType.hpp:62
constexpr unsigned int K
Specifies Potassium.
Definition: AtomType.hpp:157
constexpr unsigned int C
Specifies Carbon.
Definition: AtomType.hpp:92
constexpr unsigned int p
Specifies that the stereocenter has p configuration.
Definition: CIPDescriptor.hpp:121
The namespace of the Chemical Data Processing Library.
Primary traits template for scalar arithmetic value types.
Definition: TypeTraits.hpp:285