LocARNA-1.9.2
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends
Public Member Functions
LocARNA::SparseVector< T >::element Class Reference

Element of sparse vector. More...

#include <sparse_vector.hh>

List of all members.

Public Member Functions

 element (SparseVector< T > *m, key_t k)
 Construct as proxy for specified element in given sparse vector.
 operator value_t ()
 Access entry for which the class acts as proxy.
element operator+= (const value_t &x)
 Operator for in place addition.
elementoperator= (const value_t &x)
 Assignment operator.

Detailed Description

template<typename T>
class LocARNA::SparseVector< T >::element

Element of sparse vector.

Proxy for sparse vector entries. This is required for non-const access to vector elements in order to provide a very similar syntax for the sparse data structure and the corresponding non-sparse vector.


Constructor & Destructor Documentation

template<typename T>
LocARNA::SparseVector< T >::element::element ( SparseVector< T > *  m,
key_t  k 
) [inline]

Construct as proxy for specified element in given sparse vector.

Parameters:
mpointer to sparse vector
kkey/index of entry in given sparse vector

Member Function Documentation

template<typename T>
LocARNA::SparseVector< T >::element::operator value_t ( ) [inline]

Access entry for which the class acts as proxy.

Returns:
value of vector entry.

If entry does not exist, return the default value

template<typename T>
element LocARNA::SparseVector< T >::element::operator+= ( const value_t x) [inline]

Operator for in place addition.

Parameters:
xvalue
Postcondition:
x is added to vector entry for that the class is proxy
Returns:
*this after adding x
Note:
If entry does not exist, x is added to the default value
template<typename T>
element& LocARNA::SparseVector< T >::element::operator= ( const value_t x) [inline]

Assignment operator.

Parameters:
xvalue
Postcondition:
x is assigned to vector entry for that the class is proxy
Returns:
*this after assigning x
Note:
If x equals the default value and the entry exists, it is erased

The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends