
AMDG On 09/21/2011 12:29 PM, Pieter wrote:
I am having some trouble using user-defined units and dimensionless once. Consider the example (taken straight from the documentation) that defines nautical miles (added at the bottom).
When I do the following on VS2010:
typedef quantity<boost::units::nautical::length> TDistanceInNMI; typedef quantity<dimensionless> TDimLess;
TDistanceInNMI nm1,nm2,nm3; TDimLess d;
nm1 = nm2 + nm3; // compiles OK nm1 = d*nm2; // compiles OK nm1 = nm2 + d*nm3; // does not compile, claims there is no operator+ defined
I suppose I might have to add a dimensionless type to the 'nautical' system, or have some misconceptions on how this should work. I tried adding the following line (mimicking some of the internal stuff) but that did not due to trick:
typedef unit<dimensionless_type,system> dimensionless;
I'm surprised that this doesn't work. It seems to work when I try it. The attached compiles with MSVC 2010.
Could anyone tell me whether there is there anything I need to define to make this work?
In Christ, Steven Watanabe