
AMDG Janek Kozicki wrote:
My only complaint is about lengthy typenames. Like for example my Newton's Law function (attached calculatorform.cpp:65):
quantity<SI::force> newtons_law(const quantity<SI::mass>& m, const quantity<SI::acceleration>& a) { return m*a; }
I don't know of any good general solution. We have the identical problem: force is already taken. It makes more sense to use it for the unit than the quantity because you can also have quantity<SI::force, long double>.
<snip>
The "base_unit_converter<>" in Example 16 should be hyperlinked to the explanations what it is and how to use it.
I'll make sure that Doxygen finds the definition.
Documentation should have a FULL list of all predefined units, so it will be a quick reference for the users.
Ok.
EXAMPLES
Speed "Example 14":
With debug information and no optimizations:
<snip>
With units it is faster by two seconds. I ran the test several times, and read the code few times. Maybe executable with "slower" units is accidentally better synchronized with memory access frequency MHz. Congratulations, you beat me.
Those results were obtained with: gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)
It's easily within the noise level.
Yes it should be accepted. Before adding to CVS-HEAD please do following:
1. support calculations of conversion factors as explained above. Attached file calculatorform.cpp:47 (or convince me that I'm wrong, but hey - how to do it more conveniently than in this way?)
It should be a compile error. Try quantity<SI::dimensionless>(1.0*CGS::dyne/SI::newton) With the sandbox version
2. check for compiler used and emit an #error when unsupported compiler is detected. So that users won't waste time on futile fights with their compilers.
Ok. Thank you for your comments. In Christ, Steven Watanabe

It should be a compile error. Try
quantity<SI::dimensionless>(1.0*CGS::dyne/SI::newton)
With the sandbox version
But dimensionless quantities should be implicitly convertible to value_type, so I agree with Janek that this should just work. It should also be a compile error to attempt to create a dimensionless heterogeneous quantity that is not reducible to value_type... Matthias
participants (2)
-
Matthias Schabel
-
Steven Watanabe