
AMDG Eric Lemings <lemings <at> roguewave.com> 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() { return( lookup_currency_conversion( get_currency_name(currency<N1>()), get_currency_name(currency<N2>()))); } }; In Christ, Steven Watanabe