Boost logo

Ublas :

Subject: [ublas] Why temporary traits are not in "traits.hpp"
From: Marco Guazzone (marco.guazzone_at_[hidden])
Date: 2010-09-12 05:29:51


Hello,

I frequently use vector/matrix temporary traits for returning
temporary vector/matrix from functions.

The general definition of these traits is in "detail/temporary.hpp",
while each container type specializes it inside its own header file
(e.g. matrix.hpp).

So if you require a temporary traits from a known type, you are sure
to have the traits definition included. For instance:

--- [snip] ---
#include <boost/numeric/ublas/matrix.hpp> // temporary traits specialized here

...

template <typename T>
typename ublas::matrix_temporary_traits< ublas::matrix<T> >::type
do_something(ublas::matrix<T> const& m)
{
...
}
--- [/snip] ---

But if the container type is a template you have to include the
general temporary template declaration. For instance:

--- [snip] ---
#include <boost/numeric/ublas/detail/temporary.hpp> // temporary
traits declared here

...

template <MatrixT>
typename ublas::matrix_temporary_traits<MatrixT>::type
do_something(ublas::matrix_expression<MatrixT> const& me)
{
...
}
--- [/snip] ---

IMO, temporary traits should be *moved* (in back-compatible way)
inside the uBLAS traits header/directory.

What does the Boost.uBLAS community think about these?

Cheers,

-- Marco