Boost logo

Boost :

From: Steven Watanabe (steven_at_[hidden])
Date: 2007-03-28 15:36:38


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.

struct currency_tag : ordinal<10> {}; //physical units use 1-9

template<int N>
struct currency : ordinal<currency_base + N> {};

typedef currency<0> yen;
const char* get_currency_name(yen) { return("yen"); }
typedef currency<1> us_dollars;

template<int N1, int N2>
struct base_unit_converter<currency_tag, currency<N1>, currency<N2> > {
    typedef ... type;
    static type value() {

In Christ,
Steven Watanabe

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