![]() |
Access proxy for sparse, N-dimensional vectors.The VectorAccessProxy provides safe access to the elements of a non-const sparse vector.
The proxied access to the elements of a sparse vector is necessary since it may be possible that several insertion operations happen in the same statement. The following code illustrates this with two examples by means of the CompressedVector class:
More...
#include <VectorAccessProxy.h>
Inherits blaze::Proxy< VectorAccessProxy< VT >, ElementType_< VT > >.
Public Types | |
typedef ElementType_< VT > | RepresentedType |
Type of the represented sparse vector element. | |
typedef RepresentedType & | RawReference |
Raw reference to the represented element. | |
Public Member Functions | |
template<typename T > | |
const VectorAccessProxy< VT > & | operator= (initializer_list< T > list) const |
Initializer list assignment to the accessed sparse vector element. More... | |
template<typename T > | |
const VectorAccessProxy< VT > & | operator= (initializer_list< initializer_list< T > > list) const |
Initializer list assignment to the accessed sparse vector element. More... | |
template<typename T > | |
const VectorAccessProxy< VT > & | operator= (const T &value) const |
Assignment to the accessed sparse vector element. More... | |
template<typename T > | |
const VectorAccessProxy< VT > & | operator+= (const T &value) const |
Addition assignment to the accessed sparse vector element. More... | |
template<typename T > | |
const VectorAccessProxy< VT > & | operator-= (const T &value) const |
Subtraction assignment to the accessed sparse vector element. More... | |
template<typename T > | |
const VectorAccessProxy< VT > & | operator*= (const T &value) const |
Multiplication assignment to the accessed sparse vector element. More... | |
template<typename T > | |
const VectorAccessProxy< VT > & | operator/= (const T &value) const |
Division assignment to the accessed sparse vector element. More... | |
Constructors | |
VectorAccessProxy (VT &sv, size_t i) | |
Initialization constructor for a VectorAccessProxy. More... | |
VectorAccessProxy (const VectorAccessProxy &vap) | |
The copy constructor for VectorAccessProxy. More... | |
Destructor | |
~VectorAccessProxy () | |
The destructor for VectorAccessProxy. | |
Operators | |
const VectorAccessProxy & | operator= (const VectorAccessProxy &vap) const |
Copy assignment operator for VectorAccessProxy. More... | |
template<typename T > | |
const VectorAccessProxy & | operator= (initializer_list< T > list) const |
template<typename T > | |
const VectorAccessProxy & | operator= (initializer_list< initializer_list< T > > list) const |
template<typename T > | |
const VectorAccessProxy & | operator= (const T &value) const |
template<typename T > | |
const VectorAccessProxy & | operator+= (const T &value) const |
template<typename T > | |
const VectorAccessProxy & | operator-= (const T &value) const |
template<typename T > | |
const VectorAccessProxy & | operator*= (const T &value) const |
template<typename T > | |
const VectorAccessProxy & | operator/= (const T &value) const |
Utility functions | |
RawReference | get () const noexcept |
Returning the value of the accessed sparse vector element. More... | |
bool | isRestricted () const noexcept |
Returns whether the proxy represents a restricted sparse vector element.. More... | |
Conversion operator | |
operator RawReference () const noexcept | |
Conversion to the accessed sparse vector element. More... | |
Private Member Functions | |
Forbidden operations | |
void * | operator& () const |
Address operator (private & undefined) | |
Private Attributes | |
Member variables | |
VT & | sv_ |
Reference to the accessed sparse vector. | |
size_t | i_ |
Index of the accessed sparse vector element. | |
Access proxy for sparse, N-dimensional vectors.
The VectorAccessProxy provides safe access to the elements of a non-const sparse vector.
The proxied access to the elements of a sparse vector is necessary since it may be possible that several insertion operations happen in the same statement. The following code illustrates this with two examples by means of the CompressedVector class:
The problem (especially with the last statement) is that several insertion operations might take place due to the access via the subscript operator. If the subscript operator would return a direct reference to one of the accessed elements, this reference might be invalidated during the evaluation of a subsequent subscript operator, which results in undefined behavior. This class provides the necessary functionality to guarantee a safe access to the sparse vector elements while preserving the intuitive use of the subscript operator.
|
inlineexplicit |
Initialization constructor for a VectorAccessProxy.
sv | Reference to the accessed sparse vector. |
i | The index of the accessed sparse vector element. |
|
inline |
The copy constructor for VectorAccessProxy.
vap | Sparse vector access proxy to be copied. |
|
inlinenoexcept |
Returning the value of the accessed sparse vector element.
|
inlinenoexcept |
Returns whether the proxy represents a restricted sparse vector element..
|
inlinenoexcept |
Conversion to the accessed sparse vector element.
|
inline |
Multiplication assignment to the accessed sparse vector element.
value | The right-hand side value for the multiplication. |
|
inline |
Addition assignment to the accessed sparse vector element.
value | The right-hand side value to be added to the sparse vector element. |
|
inline |
Subtraction assignment to the accessed sparse vector element.
value | The right-hand side value to be subtracted from the sparse vector element. |
|
inline |
Division assignment to the accessed sparse vector element.
value | The right-hand side value for the division. |
|
inline |
Copy assignment operator for VectorAccessProxy.
vap | Sparse vector access proxy to be copied. |
|
inline |
Initializer list assignment to the accessed sparse vector element.
list | The list to be assigned to the sparse vector element. |
|
inline |
Initializer list assignment to the accessed sparse vector element.
list | The list to be assigned to the sparse vector element. |
|
inline |
Assignment to the accessed sparse vector element.
value | The new value of the sparse vector element. |