Hello there. I have a matrix class who use the stl vector to manage its
memory(UInt is typedef of size_t):
class Mtrx {
protected:
UInt row; ///< row dimension
UInt col; ///< column dimension
UInt ld; ///< leading dimension
vector<Double> array; ///< used to hold the memory for data
}
This matrix is designed for normal use.
On the other hand, my code is also running heavy calculation in multi-threading
environment, in which I use TBB to do parallelization. Inside the thread I
designed the local matrix, which means the matrix is local to a single thread:
class Mtrx {
However, the two different classes are only different with each other on the allocator. I am thinking, that a elegant way should be merging them together.
Do you have any ideas to do that?