|
Boost Users : |
Subject: Re: [Boost-users] [units] Creating a velocity unit
From: Ryan (boost_at_[hidden])
Date: 2013-02-21 16:56:10
>
> Yes, that's what I meant, but now that I see it written
> out, it's wrong because decltype keeps the const qualifier.
> You need the behavior of the non-standard typeof operator.
> BOOST_TYPEOF should work.
>
quantity<BOOST_TYPEOF(nautical_mile)>(2.3 * nautical_mile);
I tried this and it works. Is there a method, template or macro that lets
me create the following two line like BOOST_UNITS_STATIC_CONSTANT?
typedef metric::nautical_mile_base_unit::unit_type nautical_mile_unit;
static const nautical_mile_unit nautical_mile;
That way I don't have to create a name for the type and only use
BOOST_TYPEOF if I need the type from the global constant.
Ryan
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