Boost logo

Boost :

From: Matthias Schabel (boost_at_[hidden])
Date: 2004-01-12 22:17:50

> 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.

This is a good point - in fact, since I'm allowing user-defined classes
as value types,
I really should template multiplication and division on two classes.
that means that there needs to be a definition of
multiply<T,V>::type... Hmm...
> Maybe std::complex< unit<electric_current, double> > is not such a bad
> idea?

Could also work, I suppose. Seems backwards to me, though.

Matthias Schabel, Ph.D.
Utah Center for Advanced Imaging Research
729 Arapeen Drive
Salt Lake City, UT 84108
801-587-9413 (work)
801-585-3592 (fax)
801-706-5760 (cell)
801-484-0811 (home)
mschabel at ucair med utah edu

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