From: Andy Little (andy_at_[hidden])
Date: 2004-01-09 06:26:46
"Andy Little" <andy_at_[hidden]> wrote
> "Jan Langer" <jan_at_[hidden]> wrote
> > Andy Little wrote:
> > > std::complex<q_impedance::R> Z=
> > > std::complex<q_voltage::V>() / std::complex<q_current::I>().
> > >
> > > No idea if that would actually work though.... Anybody ...?
> > it is correct. but i would prefer
> > typedef std::complex <double> value_type;
> > voltage <value_type> v (value_type (2, 3));
> > current <value_type> i (value_type (1, 4));
> > impedance <value_type> z = v / i;
> > my point is just that std::complex <double> is the value type and should
> > replace your implicit (i know its only for convenience) double.
> > jan
> Will try to compile and see what happens.
using namespace physical_quantities;
// Z = V/I;
typedef std::complex<double> value_type;
// ZZ = VV/II;
Compiles this far (VC7.1).... but no calcs
First (complex using pq value_type) is I think only specialised for
Must have ctor args as shown to get this far.
Second (mine using complex value_type) Is set up for inbuilts only... stalls
in my math_promote<A,B>::type mechanism.
which is set up to return a void type on non-inbuilts
Would need to put std::complex somewhere in the promotion hierarchy, perhaps
by interrogating its value_type
Interesting... perhaps could be made to work either way :-)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk