|
Ublas : |
From: Dima Sorkin (dsorkin_at_[hidden])
Date: 2005-07-11 01:46:20
Quoting Andrew Rieck <arieck_at_[hidden]>:
> > This is my suggested change to the default handling of traits. This
> > treats any
> > unknown type as a scalar and defines a default traits definition. This
> should
> > certainly be a lot easier for new users to use and simplify many cases.
>
> This work is already done in the following (excluding the redundant member
> functions):
>
> #include <limits>
> #include <boost/call_traits.hpp>
The boost call traits do not define the return types of
arithmetic operations (as far as I know). For example,
having "z = x+y",where "x:double","y:complex<double>",
you need to calculate the type of "z" somehow.
Here needed something like: plus_traits<S1,S2>.
--- template<typename S1,typename S2, typename ARITHM_TRAITS = internal_default_arithmtraits<S1,S2> > void some_func(S1 &s1,S2 &s2){ //This func needs to store the intermediate results of "+" ... typename ARITHM_TRAITS::plus_result_type tmp = s1+s2; ... } ---- Regards, Dima. > > Your model of scaler_traits is really a fat interface for a complex type, > not for a generic scaler_trait. > There is no need to include member functions like abs, etc, in a traits > interface. > > Kind regards, > Andrew