GOTO 
index
matrix<T, Row>
Defined in header file:  matrix.hh

Description

A matrix is a ...

Example

    matrix<int> m(3, 2, 100);
    m[2][1] = 9;
    m[1][0] = m[2][1] + m[1][1];
    assert((m[1][0] == 109));
    cout << m << endl;

The result that is written to stdout is:

[[100 100]
 [109 100]
 [100 9]
]
  

Public base classes

Template parameters

Parameter Description Default
T The value_type of the matrix, i.e. the type of the stored elements.  
Row The type of a row. unbounded_vector<T>

Constructors

Constructor Description
matrix() Creates an empty matrix.
matrix(const matrix& m) Copy constructor.
matrix(size_type n) Creates a matrix with n empty rows.
matrix(size_type rows, size_type cols) Creates a matrix with _rows_ rows and _cols_ cols.
matrix(rows, cols, T()) Creates a matrix with _rows_ rows and _cols_ cols. Each element is a copy of _t_.
matrix(size_type rows, size_type cols, const T& t)  

Members

Types Description
value_type The type (T) of the objects stored in the matrix.
pointer_type Pointer to T.
reference Reference to T.
const_reference Const reference to T.
size_type An unsigned integral type.
difference_type A signed integral type.
row_type The type (Row) of a row.
iterator An iterator to iterate through the rows.
const_iterator Const iterator.
reverse_iterator An iterator to iterate backwards through the rows.
const_reverse_iterator Const backward iterator.
Methods
row_type&  operator[](size_type n) Returns a reference to the given row.
const row_type&  operator[](size_type n)   const Returns a const reference to the given row.
void  push_back(const row_type& row) Inserts a new row at the end.
void  pop_back() Removes the last row.
size_type  size()   const Returns the number of rows.
size_type  max_size()   const Returns the maximum number of rows.
bool  empty()   const Returns true if the matrix contains no rows.
index

Copyright © 2005-2006 Retrieval Solutions. All rights reserved.