![]() |
Chemical Data Processing Library C++ API - Version 1.4.0
|
Proxy that exposes a single (key, value) entry of a sparse container as a writable reference. More...
#include <SparseContainerElement.hpp>
Public Types | |
| typedef C | ContainerType |
| The sparse container type the proxy references. More... | |
| typedef K | KeyType |
| The key type used to address an entry of the container. More... | |
| typedef ContainerType::ValueType | ValueType |
| The value type stored in the container. More... | |
| typedef ContainerType::SizeType | SizeType |
| The size type used by the container. More... | |
| typedef ValueType & | Reference |
| Mutable reference type to a value. More... | |
| typedef ContainerType::ConstReference | ConstReference |
| Constant reference type to a value (as defined by the container). More... | |
| typedef ContainerType::ArrayType | ArrayType |
Underlying associative-array type of the container (typically a std::map / std::unordered_map specialization). More... | |
Public Member Functions | |
| SparseContainerElement (ContainerType &c, KeyType key) | |
| Constructs the proxy for the (key, value) entry of the sparse container c. More... | |
| SparseContainerElement & | operator= (const SparseContainerElement &p) |
| Copies the value pointed to by p into the entry pointed to by this proxy. More... | |
| template<typename D > | |
| SparseContainerElement & | operator= (const D &d) |
| Assigns the value d to the entry pointed to by this proxy. More... | |
| template<typename D > | |
| SparseContainerElement & | operator+= (const D &d) |
| Adds d to the value of the entry pointed to by this proxy. More... | |
| template<typename D > | |
| SparseContainerElement & | operator-= (const D &d) |
| Subtracts d from the value of the entry pointed to by this proxy. More... | |
| template<typename D > | |
| SparseContainerElement & | operator*= (const D &d) |
| Multiplies the value of the entry pointed to by this proxy by d. More... | |
| template<typename D > | |
| SparseContainerElement & | operator/= (const D &d) |
| Divides the value of the entry pointed to by this proxy by d. More... | |
| template<typename D > | |
| bool | operator== (const D &d) const |
| Tests the value of the entry pointed to by this proxy for equality with d. More... | |
| template<typename D > | |
| bool | operator!= (const D &d) const |
| Tests the value of the entry pointed to by this proxy for inequality with d. More... | |
| operator ConstReference () const | |
Implicit conversion to a const reference to the value of the entry pointed to by this proxy (returns a default-constructed value when the entry does not exist in the underlying storage). More... | |
Proxy that exposes a single (key, value) entry of a sparse container as a writable reference.
Reading the proxy returns the value associated with key (or a default-constructed value if no entry exists). Writing to the proxy inserts/updates the entry; assigning the default-constructed value removes the entry from the underlying sparse storage.
| C | The sparse container type (must expose KeyType, ValueType, SizeType, ConstReference, ArrayType and getData()). |
| K | The key type (defaults to C::KeyType). |
| typedef C CDPL::Math::SparseContainerElement< C, K >::ContainerType |
The sparse container type the proxy references.
| typedef K CDPL::Math::SparseContainerElement< C, K >::KeyType |
The key type used to address an entry of the container.
| typedef ContainerType::ValueType CDPL::Math::SparseContainerElement< C, K >::ValueType |
The value type stored in the container.
| typedef ContainerType::SizeType CDPL::Math::SparseContainerElement< C, K >::SizeType |
The size type used by the container.
| typedef ValueType& CDPL::Math::SparseContainerElement< C, K >::Reference |
Mutable reference type to a value.
| typedef ContainerType::ConstReference CDPL::Math::SparseContainerElement< C, K >::ConstReference |
Constant reference type to a value (as defined by the container).
| typedef ContainerType::ArrayType CDPL::Math::SparseContainerElement< C, K >::ArrayType |
Underlying associative-array type of the container (typically a std::map / std::unordered_map specialization).
|
inline |
Constructs the proxy for the (key, value) entry of the sparse container c.
| c | The sparse container. |
| key | The key of the addressed entry. |
|
inline |
Copies the value pointed to by p into the entry pointed to by this proxy.
| p | The source proxy. |
|
inline |
Assigns the value d to the entry pointed to by this proxy.
If d equals the default-constructed value, the entry is removed from the underlying sparse storage.
| D | The type of the assigned value (convertible to ValueType). |
| d | The value to assign. |
|
inline |
Adds d to the value of the entry pointed to by this proxy.
| D | The type of the addend (must support value += d). |
| d | The value to add. |
|
inline |
Subtracts d from the value of the entry pointed to by this proxy.
| D | The type of the subtrahend (must support value -= d). |
| d | The value to subtract. |
|
inline |
Multiplies the value of the entry pointed to by this proxy by d.
| D | The type of the multiplier (must support value *= d). |
| d | The multiplier. |
|
inline |
Divides the value of the entry pointed to by this proxy by d.
| D | The type of the divisor (must support value /= d). |
| d | The divisor. |
|
inline |
Tests the value of the entry pointed to by this proxy for equality with d.
| D | The type of the right-hand side (must support value == d). |
| d | The value to compare against. |
true if the entry's value equals d, and false otherwise.
|
inline |
Tests the value of the entry pointed to by this proxy for inequality with d.
| D | The type of the right-hand side (must support value != d). |
| d | The value to compare against. |
true if the entry's value differs from d, and false otherwise.
|
inline |
Implicit conversion to a const reference to the value of the entry pointed to by this proxy (returns a default-constructed value when the entry does not exist in the underlying storage).
const reference to the value.