Boost logo

Boost :

From: Steven Watanabe (steven_at_[hidden])
Date: 2007-04-03 13:07:55


David Walthall <walthall <at>> writes:

> Here is my review of the proposed Boost.Units library.
> <snip>
> * What is your evaluation of the design?
> The only complaint I have is that unique values of ordinal<N> have to be
> used.
> <snip>

Nod. The only way to prevent collisions is to use
more bits and either guids or compile time strings
storing the fully qualified name.

> <snip>
> It would be nice if the
> typedef for a new type, such as molar_energy_type, was something like:
> composite_dimension<energy_type,1, amount_type,-1>::type
> instead of:
> composite_dimension<length_tag,2, mass_tag,1, time_tag,-2,
> amount_tag,-1>::type

The existing composite_dimension<> is more efficient.
If we made such a template it should work for quantities
and units, too. composite<SI::energy, 1, SI::amount, -1>::type

template<class T0 = dimensionless_type, int E0 = 0,
         class T1 = dimensionless_type, int E1 = 0,
         class T2 = dimensionless_type, int E2 = 0,
struct composite {
    typedef typename static_power<T0, static_rational<E0> >::type t0;
    typedef typename static_power<T1, static_rational<E1> >::type t1;
    typedef typename static_power<T2, static_rational<E2> >::type t2;
    typedef t0 type0;
    typedef typename static_multiply<type0, t1>::type type1;
    typedef typename static_multiply<type1, t2>::type type2;
    typedef typeN type;

> <snip>
> My final suggestion is that CODATA constants should be available for
> libraries that do not support typeof. (I expect that this will be
> fairly straightforward since the units are known.)

Boost.Typeof is in 1.34 and we have support for emulation.

> <snip>

Thank you for your review.

In Christ,
Steven Watanabe

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