27 #ifndef CDPL_MATH_SPARSECONTAINERELEMENT_HPP
28 #define CDPL_MATH_SPARSECONTAINERELEMENT_HPP
50 template <
typename C,
typename K =
typename C::KeyType>
68 typedef typename ContainerType::ValueType
ValueType;
73 typedef typename ContainerType::SizeType
SizeType;
88 typedef typename ContainerType::ArrayType
ArrayType;
120 template <
typename D>
134 template <
typename D>
150 template <
typename D>
166 template <
typename D>
182 template <
typename D>
198 template <
typename D>
212 template <
typename D>
236 cntnr.getData().erase(key);
239 std::pair<typename ArrayType::iterator, bool> pos = cntnr.getData().insert(
typename ArrayType::value_type(key, v));
242 pos.first->second = v;
248 typename ArrayType::const_iterator it = cntnr.getData().find(key);
250 if (it == cntnr.getData().end())
265 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:63
SparseContainerElement & operator-=(const D &d)
Subtracts d from the value of the entry pointed to by this proxy.
Definition: SparseContainerElement.hpp:151
SparseContainerElement & operator/=(const D &d)
Divides the value of the entry pointed to by this proxy by d.
Definition: SparseContainerElement.hpp:183
ValueType & Reference
Mutable element value reference type.
Definition: SparseContainerElement.hpp:78
ContainerType::SizeType SizeType
The size type used by the container.
Definition: SparseContainerElement.hpp:73
ContainerType::ValueType ValueType
The value type stored in the container.
Definition: SparseContainerElement.hpp:68
SparseContainerElement & operator=(const SparseContainerElement &p)
Copies the value pointed to by p into the entry pointed to by this proxy.
Definition: SparseContainerElement.hpp:103
SparseContainerElement(ContainerType &c, KeyType key)
Constructs the proxy for the (key, value) entry of the sparse container c.
Definition: SparseContainerElement.hpp:95
bool operator!=(const D &d) const
Tests the value of the entry pointed to by this proxy for inequality with d.
Definition: SparseContainerElement.hpp:213
bool operator==(const D &d) const
Tests the value of the entry pointed to by this proxy for equality with d.
Definition: SparseContainerElement.hpp:199
SparseContainerElement & operator=(const D &d)
Assigns the value d to the entry pointed to by this proxy.
Definition: SparseContainerElement.hpp:121
SparseContainerElement & operator+=(const D &d)
Adds d to the value of the entry pointed to by this proxy.
Definition: SparseContainerElement.hpp:135
SparseContainerElement & operator*=(const D &d)
Multiplies the value of the entry pointed to by this proxy by d.
Definition: SparseContainerElement.hpp:167
C ContainerType
The sparse container type the proxy references.
Definition: SparseContainerElement.hpp:58
ContainerType::ArrayType ArrayType
Underlying associative-array type of the container (typically a std::map / std::unordered_map special...
Definition: SparseContainerElement.hpp:88
ContainerType::ConstReference ConstReference
Constant element value reference type (as defined by the container).
Definition: SparseContainerElement.hpp:83
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:307