Boost logo

Ublas :

From: Gunter Winkler (guwi17_at_[hidden])
Date: 2006-10-16 04:15:05

On Friday 13 October 2006 16:11, Nico Galoppo wrote:
> Gunter Winkler wrote:
> > The problem is, that the value type of the vector adaptor is (const
> > double) and norm_1 tries to use it as type of the temporary. One should
> > not use real_type as type for temporary results, but something like

> Are you suggesting this should be fixed in the norm_1 code?

Some ublas functional need temporary variables to compute the results. These
are usually defines as type_traits<T>::value_type or
type_traits<T>::real_type. This works if T is mutable, but it fails if T is a
constant type. (Thus you cannot compute norm_1 of vector<const double>).

There are some possible solutions:

1. each functional has to remove the constness of value_type or real_type
(by boost::remove_const<..> from boost/traits/remove_const.hpp)
2. we modify type_traits to always use the unqualified type (but this may
break other expressions)
3. we add an unqualified_value_type, unqualified_real_type to type_traits.
(this requires changes on type traits and functionals)

What do others think about the three possibilities?