Boost logo

Boost Users :

Subject: [Boost-users] [units][phoenix] static physical constants don't play well with phoenix?
From: alfC (alfredo.correa_at_[hidden])
Date: 2011-04-30 01:19:37


 This post is just to point out a deficiency of either boost.phoenix
or boost.units and see if there are workarounds.

 Phoenix 3 now plays well with Boos.units quantities out of the box
but for some reason it does not play well with boost.units static
physical constants. Like in the following example. This is because the
constant 'hbar' is not a normal quantity type but a
boost::units::constant< ... hbar_t > type. do you think physical
constants could be defined as normal quantities in the future so it
can play well with phoenix?


int main(){
        using namespace boost::units;
        using namespace boost::phoenix;
        using namespace boost::phoenix::arg_names;

        quantity<si::action> const hbarvar =
        std::clog << (arg1 * hbarvar)(5.) << std::endl; // works
        std::clog << (arg1 * boost::units::si::constants::codata::hbar)(5.)
<< std::endl; //doesn't work

        return 0;

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at