|
Boost Users : |
Subject: Re: [Boost-users] [units] Creating a velocity unit
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2013-02-21 15:18:20
AMDG
On 02/21/2013 12:09 PM, Ryan wrote:
>>
>> I suppose that it would also be possible to use only the
>> object, and use decltype whenever you need a type.
>
>
> I tried using the decltype to get the type but got an error. Is this how
> you meant to use it?
>
> typedef metric::nautical_mile_base_unit::unit_type nautical_mile_unit;
> static const nautical_mile_unit nautical_mile;
>
> quantity<decltype(nautical_mile)>(2.3 * nautical_mile);
>
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.
In Christ,
Steven Watanabe
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