Boost logo

Boost Users :

Subject: Re: [Boost-users] [Boost.Units] radians and degrees
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2010-10-02 18:30:34


  AMDG

On 10/2/2010 11:17 AM, Diederick C. Niehorster wrote:
> I have just ventured into Boost.Units as me and my colleagues
> frequently make errors in our code by mixing up degrees and radians
> (function takes one but we supply it the other). In some cases a
> degree representation makes sense, in other the radian representation.
> Basically, I want to use radian and degree quantities and use implicit
> conversions to freely interchange between the two (say a user supplies
> degrees to a function whose declaration asks for radians, or vice
> versa, things should simply be converted on the fly so that the
> function has the input it expects and its output is not wrong). I have
> no need for the SI system or anything else.
>
> I am however having some trouble understanding something that must be
> rather basic. Consider the following code:
>
> ----
> <snip> However, why does the
> declaration initialization two lines above work fine?

The Units library doesn't allow implicit conversions between
different units. It does allow explicit conversions, which is
why direct initialization works.

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