Boost logo

Boost :

From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-05-28 12:08:14


Torsten Mähne wrote:
> I noticed that currently Units and Lambda use two independent systems of
> trait classes to determine the return type of algebraic operations like
> +, -, *, /.

Boost.Units actually relies on Boost.Typeof for user types.

> - Can some of the partial specializations be dropped?

I don't think so.

> - Is there a need to add other specializations
> (e.g, for boost::units::unit<Dim, System, Enable>)?

Drop the Enable parameter, it's an implementation detail which I plan to
remove soon.

> - Is there a way to work around boost::lambda:bind's limitation
> concerning the binding of overloaded functions? The required
> static_cast to the function pointer (referring, e.g., a function
> from boost/units/cmath.hpp) is tedious.

The problem is avoided by creating a function object. (untested)

struct sin_t {
    template<class Args>
    struct sig {
        typedef typename boost::tuples::element<0>::type arg1_type;
        BOOST_TYPEOF_NESTED_TYPEDEF(nested, (sin(make<arg1_type>())));
        typedef typename nested::type type;
    template<class T>
    ... operator()(const T& arg) { return(sin(arg)); }

In Christ,
Steven Watanabe

Boost list run by bdawes at, gregod at, cpdaniel at, john at