|
Boost Users : |
Subject: Re: [Boost-users] [units] Creating a velocity unit
From: Ryan (boost_at_[hidden])
Date: 2013-02-21 13:25:48
Thanks for the link it was helpful. I tried both methods and they both
compiled. It seems we can use the simpler form of decltype because it
provides perfect forwarding. Is this a correct interpretation?
Neither of these two typedef seems to behave as I expected. When creating
a quantity with these typedefs I had to call them as a method to get the
code to compile.
quantity<si::velocity> a(2.3 * nautical_miles_per_hour1());
quantity<si::velocity> b(2.4 * nautical_miles_per_hour2());
quantity<si::velocity> c(2.5 * si::meters_per_second);
Is there a way to get my type of nautical_miles_per_hour to behave like
meters_per_second?
Ryan
//Provided for the Discussion
using namespace boost::units;
typedef metric::nautical_mile_base_unit::unit_type nautical_mile_unit;
typedef metric::hour_base_unit::unit_type hour_unit;
typedef decltype(nautical_mile_unit() / hour_unit())
nautical_miles_per_hour1;
typedef divide_typeof_helper<nautical_mile_unit, hour_unit>::type
nautical_miles_per_hour2;
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net