Boost logo

Boost Users :

Subject: [Boost-users] [units] initialization from zero magic
From: alfC (alfredo.correa_at_[hidden])
Date: 2010-06-14 02:18:06


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.

Thanks,
Alfredo


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