Instigate Open Source Documentation

instigate::stl::matrix::interface< T > Struct Template Reference

Interface for the Vector Concept. More...

#include <_matrix.hpp>

Inheritance diagram for instigate::stl::matrix::interface< T >:

instigate::generic::assignable::interface< T > instigate::generic::default_constructible::interface< T >

List of all members.

Public Types

typedef T::size_type size_type
 Typename for the index type and matrix size type.
typedef T::value_type::value_type value_type
 Typename for the matrix elements.

Static Public Member Functions

static size_type get_number_of_rows (const T &x)
 Returns the height of the matrix.
static size_type get_number_of_columns (const T &x)
 Returns the width of the matrix.
static value_type get_element (const T &x, const size_type &r, const size_type &c)
 Gets element of a matrix by index.
static void set_element (T &x, const size_type &r, const size_type &c, const value_type &v)
 Modifies value of element with given index.
static void construct (T &x, const size_type &r, const size_type &c)
 Constructs matrix with the given dimensions.


Detailed Description

template<typename T>
struct instigate::stl::matrix::interface< T >

Interface for the Vector Concept.

This is a "non-intrusive" interface for the matrix type. A type is matrix if it is possible to query it's dimensions and to access it's elements by indices in constant-time.

The default implementation is made so that std::vector< std::vector<T> > automatically becomes a model of this concept.

Todo:
Also provide specialization for 2-dimensional C arrays with fixed size.

Member Function Documentation

template<typename T>
static size_type instigate::stl::matrix::interface< T >::get_number_of_rows ( const T &  x  )  [inline, static]

Returns the height of the matrix.

Parameters:
x The matrix.
Complexity
Must be O(1).

Referenced by instigate::stl::matrix::interface< T >::get_element(), and instigate::stl::matrix::interface< T >::set_element().

template<typename T>
static size_type instigate::stl::matrix::interface< T >::get_number_of_columns ( const T &  x  )  [inline, static]

Returns the width of the matrix.

Parameters:
x The matrix.
Complexity
Must be O(1)

Referenced by instigate::stl::matrix::interface< T >::get_element(), and instigate::stl::matrix::interface< T >::set_element().

template<typename T>
static value_type instigate::stl::matrix::interface< T >::get_element ( const T &  x,
const size_type r,
const size_type c 
) [inline, static]

Gets element of a matrix by index.

Parameters:
x The matrix.
r The row of the element.
c The column of element.
Returns:
The element of x with index i.

References instigate::stl::matrix::interface< T >::get_number_of_columns(), and instigate::stl::matrix::interface< T >::get_number_of_rows().

template<typename T>
static void instigate::stl::matrix::interface< T >::set_element ( T &  x,
const size_type r,
const size_type c,
const value_type v 
) [inline, static]

Modifies value of element with given index.

Parameters:
x The matrix.
r The row number of the element.
c The column number of the element.
v The new value for the element.

References instigate::stl::matrix::interface< T >::get_number_of_columns(), and instigate::stl::matrix::interface< T >::get_number_of_rows().

template<typename T>
static void instigate::stl::matrix::interface< T >::construct ( T &  x,
const size_type r,
const size_type c 
) [inline, static]

Constructs matrix with the given dimensions.

Parameters:
x The matrix.
r The number of rows.
c The number of columns.


The documentation for this struct was generated from the following file:


© Instigate CJSC, Open Source