blitzpp / blitz

Blitz++ Multi-Dimensional Array Library for C++
https://github.com/blitzpp/blitz/wiki
Other
406 stars 84 forks source link

Convert TinyVector to std::array (C++11) #10

Open citibeth opened 8 years ago

citibeth commented 8 years ago

It seems that TinyVector and std::array do the same thing. So consider typedefing one to the other when using a C++11 compiler.

lutorm commented 8 years ago

Unless I'm mistaken, std::array does not define any math operators. That said, it might be possible to usefully leverage it as the backend to TinyVector.

citibeth commented 8 years ago

In using blitz::Array, I'm doing too many unnecessary conversions between std::array and TinyVector. We can define the math operations externally to the class. But yes, it seems that simple typedef won't work.

On Tue, Jan 19, 2016 at 2:35 PM, lutorm notifications@github.com wrote:

Unless I'm mistaken, std::array does not define any math operators. That said, it might be possible to usefully leverage it as the backend to TinyVector.

— Reply to this email directly or view it on GitHub https://github.com/blitzpp/blitz/issues/10#issuecomment-172961519.

citibeth commented 8 years ago

Maybe the solution is to add an implicit constructor to TinyVector from std::array. The "needless" conversion would still be happening. But it would now be under the hood and we probably won't care. This would be a more backwards-compatible way of doing things.

On Tue, Jan 19, 2016 at 2:42 PM, Elizabeth Fischer rpf2116@columbia.edu wrote:

In using blitz::Array, I'm doing too many unnecessary conversions between std::array and TinyVector. We can define the math operations externally to the class. But yes, it seems that simple typedef won't work.

On Tue, Jan 19, 2016 at 2:35 PM, lutorm notifications@github.com wrote:

Unless I'm mistaken, std::array does not define any math operators. That said, it might be possible to usefully leverage it as the backend to TinyVector.

— Reply to this email directly or view it on GitHub https://github.com/blitzpp/blitz/issues/10#issuecomment-172961519.