Skip to content

Commit

Permalink
Added [] for SGMatrix
Browse files Browse the repository at this point in the history
  • Loading branch information
lisitsyn committed Sep 25, 2011
1 parent d6ac38d commit 2642355
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/shogun/lib/DataType.h
Expand Up @@ -324,6 +324,22 @@ template<class T> class SGMatrix
free_matrix();
}

/** operator overload for matrix read only access
* @param index to access
*/
inline const T& operator[](index_t index) const
{
return matrix+index;
}

/** operator overload for matrix r/w access
* @param index to access
*/
inline T& operator[](index_t index)
{
return matrix+index;
}

public:
/** matrix */
T* matrix;
Expand Down

0 comments on commit 2642355

Please sign in to comment.