Hello all,
please excuse the weird subject line. I have just introduced boost units as
length quantity for vectors into my project here.
What previously was:
typedef boost::qvm::vec vec3;
is now:
typedef boost::units::quantity qlength;
typedef boost::qvm::vec vec3;
Which seems to work OK so far, I'm not done testing. While converting all
my unit tests I came to wonder is how this is best adopted.
I have lots of lines like:
vec3 v = get_some_value();
and then I test the individual component values like this:
BOOST_CHECK_CLOSE(X(v), 42.0, 0.001); // check for length of 42 meters
Now this would have to be rewritten to:
BOOST_CHECK_CLOSE(X(v).value(), 42.0, 0.001);
But doing this, I imply the length is in meters, right? Doesn't that defeat
the purpose a little? I feel this would be better:
BOOST_CHECK_CLOSE(X(v), 42.0 * meters, 0.001);
but the Macro won't accept this as this is not a floating point type
anymore.
Does anybody have some hint as to how this is best addressed while still
have maximum readability?
All my best...
Stephan