Recently I found out that the ublas matrix uses T& when creating a reference to a matrix element.
This causes a problem for me, as I'm developing an ublas matrix that has its data on disk rather than in memory:
ublas::matrix< double, row_major, DiskStorage > m; // stores data on disk
I would like ublas::matrix to use the reference type that is declared by its storage type.
typedef A::reference reference;
My question is: is this a mistake in the design, or is there a reason why T& should always be the reference type of an ublas matrix?
Thanks in advance,
As an illustration, here is some code using the reference type of the DiskStorage class:
DiskStorage aDiskStorage( 100 ); // create a disk storage with 100 elements
DiskStorage::reference r = aDiskStorage;
r = 123.456; // writes 123.456 to disk