|
Boost Users : |
Subject: Re: [Boost-users] [units] initialization from zero magic
From: Cory Nelson (phrosty_at_[hidden])
Date: 2010-06-14 02:46:07
On Sun, Jun 13, 2010 at 11:18 PM, alfC <alfredo.correa_at_[hidden]> wrote:
>
> Hi,
>
> Â I am curious. In Boost.Units it is not possible to *initialize* a
> quantity from a plain value, the closest thing to it is
> the ::from_value static member function. But ... What is the magic
> that makes this particular initialization compile?
>
> Â boost::units::quantity<si::length> L(0); //compiles and works as
> expected
>
> but *not* these ones:
>
> Â boost::units::quantity<si::length> L(1); //does not compile
> or
> Â boost::units::quantity<si::length> L(0.); //does not compile
>
> (gives a compile error, "no matching function for call to
> '...::quantity(int/double)')
>
> By the way, I think it is a great feature! I am interested to know how
> is this achieved.
Without looking at the code, my first guess is that it takes a
pointer, and you are really passing a null pointer.
-- Cory Nelson http://int64.org
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