$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [Boost-users] [units] Creating a velocity unit
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2013-02-20 22:11:10
AMDG
On 02/20/2013 06:32 PM, Ryan wrote:
> Boost Community,
> 
> I'm trying to create a custom velocity unit.  I would like to create a unit
> that is in nautical miles per hour to represent my speed value.  If I use
> pound_force.hpp as an example of units with more than one dimension I can
> create the following.
> 
> BOOST_UNITS_DEFINE_BASE_UNIT_WITH_CONVERSIONS(metric,
> nautical_mile_per_hour, "nautical mile per hour", "nmi h^-1", factor,
> si::velocity, ???);
> 
> If this is the right track, what id would I use and how do I know that it
> is unique?
> 
> This seems forced.  I would rather define this unit in terms of meters per
> second.  Nautical miles is already in terms of meters and hours is also
> defined as a scale of seconds.  Can I somehow use these two already defined
> units to create the new unit?  How would I do this?
> 
You probably don't need to define a base unit.
Just use:
typedef decltype(
  nautical_mile_base_unit::unit_type() /
  hour_base_unit::unit_type()) nautical_miles_per_hour;
In Christ,
Steven Watanabe