From: Andy Little (andy_at_[hidden])
Date: 2004-01-05 16:09:03
"Dan W." <danw_at_[hidden]> wrote in message
> > Yep... or come out of the physical_quantities system for things it cant
> > handle and use a good ole double,
> > Works a charm :-)
> No it doesn't! :-)
A value_type will always fulfill the role, but it is weakly typed.
I assume you are alluding to my use of ints for the
abstract-physical-quantity part of the physical-quantities type.
I find that simple and expressive... but limiting.
Maybe named powers-of-dimension would be a better bet. I could start using
enums and then maybe use types.
Of course I shot that idea down pretty quickly saying it was a bit ugly.
maybe I was wrong.
The favoured boost solution is 'use a rational type'. Maybe .. but rational
fractions are a limited set.
So some time down the road someone will want to use pi().
Use a fixed type... maybe too... but accuracy is limited.
Use a floating type... but bang goes the compile time aspect.
After this there will be further math requirements.
The abstract type is used in type comparisons so if compile time math is
limited to integer.
Of course all this sounds great in theory, trivial on the page.. 'it only
I will bear all that in mind (A working demo of other peoples ideas is a lot
more useful to me than just suggestions)...and follow events... meanwhile my
solution, workaround call it what you will is as previously.
I have been presented with various objection on this thread. I assume that
when the tail goes quiet the problem has been solved.
Either that or it was just a passing jab by someone who is not very
My current solution for my pqs type is: Where the physical-quantities type
cant fulfill what you want fall back on old style inbuilts.
The resulting code may be full of holes but may give a flavour of coding
with strongly typed physical-quantities.
Alternatively if you have better ideas on physical-quantities... build your
own working code, which I can run and use and I will be happy to evaluate
As I have said before... show me the better implementation with all the
problems solved and I shall delete my type from the collective
After all the talk of a type that will fulfill every need for every user ...
it had better be PDG.
Meanwhile I am waiting.
Try out my examples as they are ... (gcc 3.2, VC7.1 ... I hope will work on
close conforming compilers.... feedback on compile run would be very
Whether you dont like the syntax, the lack of boostisms, the implicit
conversions or anything else , They will give you some basic flavour of
coding with physical-quantities.You may decide in practise that there is no
advantage over inbuilts. That in itself would be useful feedback... then we
could all pack up and go home
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk