Boost logo

Boost :

From: Anatoli Tubman (anatoli_at_[hidden])
Date: 2004-01-12 05:26:21

I agree that the underlying type should be a template parameter.
I just want to note that support of std::complex would require
operators with mixed underlying types. That is,

  template <typename u1, typename u2, typename v1, typename v2>
  unit<unit_product_type<u1, u2>::type, number_product_type<v1, v2>::type>
  operator* (unit<u1, v1>, unit <u2, v2>) { ... }

rather than

  template <typename u1, typename u2, typename v>
  unit<unit_product_type<u1, u2>::type, v>
  operator* (unit<u1, v>, unit <u2, v>) { ... }

This is because one would frequently need to multiply a complex by a real.

Maybe std::complex< unit<electric_current, double> > is not such a bad idea?

anatoli at ptc dot com -- opinions are mine

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