Boost logo

Boost :

From: Michael Fawcett (michael.fawcett_at_[hidden])
Date: 2007-03-28 17:01:36

On 3/28/07, Steven Watanabe <steven_at_[hidden]> wrote:
> Eric Lemings <lemings <at>> writes:
> > Question. Does this base_unit_converter class template imply that there
> > must be a template specicialization for every conversion between all
> > combinations of compatible units? If so, I would have a serious issue
> > with that.
> Answer. Yes it does. If it is too much of a problem
> you can use partial specialization.

Steven, do you think it would be easy enough to provide a reciprocal
helper for when conversions are that straightforward (I'm not familiar
enough in this domain to know how many instances there are where the
conversion is not)?

E.g. currently you have to do:

struct base_unit_converter<length_tag,nautical::system_tag,SI::system_tag>
    typedef double type;
    static type value() { return 1.852e3; }

struct base_unit_converter<length_tag,SI::system_tag,nautical::system_tag>
    typedef double type;
    static type value() { return 1.0/1.852e3; }

Just defining the first one should be enough, and the second one
should implicitly be the reciprocal of the first (but still give the
user the option to explicitly say otherwise, of course).

--Michael Fawcett

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