erjot
erjot

Reputation: 1412

Dynamic matrix with contiguous storage

I want a matrix container class that has similar functionality to vector<vector<type>>, but stores elements in contiguous memory. I bet there is none in the standard library (including C++0x); does Boost provide one?

Upvotes: 2

Views: 419

Answers (2)

Rhys Ulerich
Rhys Ulerich

Reputation: 1332

I think Boost.MultiArray does what you want.

Upvotes: 0

T.E.D.
T.E.D.

Reputation: 44804

It looks like you want the misleadingly-named Boost Matrix.

The templated class matrix is the base container adaptor for dense matrices. For a (m x n)-dimensional matrix and 0 <= i < m, 0 <= j < n every element mi, j is mapped to the (i x n + j)-th element of the container for row major orientation or the (i + j x m)-th element of the container for column major orientation.

Upvotes: 3

Related Questions