Boost logo

Boost Users :

Subject: Re: [Boost-users] [units] Creating a velocity unit
From: Ryan (boost_at_[hidden])
Date: 2013-02-21 15:09:41


>
> The difference is that meters_per_second is an object,
> not a type:
>
> static const si::velocity meters_per_second;
>

I see.

> At this point, I prefer to use the type, because
> I don't like having to come up with two different
> names for the type and the global constant.

That is a pain.

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);

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