Boost logo

Boost Users :

Subject: [Boost-users] [units] combined systems and prefixes and output
From: alfC (alfredo.correa_at_[hidden])
Date: 2011-07-06 16:16:11


 After some effort I managed to add a new system to boost units
(namely "atomic"). The system works so far until I start using si
prefixes in combination and printing

int main(){
        clog << 4.*atomic::hbar << endl; // output: 4 hbar
        clog << 4.*(si::femto*si::second) << endl; // output: 4 fs
        clog << 4.*(atomic::hbar/si::second) << endl; // output: 4 s^-1 hbar
        auto a = atomic::hbar/(si::femto*si::second); // ok
        clog << a << endl; // output: P(s^-1 hbar)
        auto b = 4.*atomic::hbar/(si::femto*si::second); // ok

        clog << b << endl; // error!!!! why?

        return 0;

As you see all lines work as expected except for the last line. Is
there a workaround? do I need to define prefixes specific for the
other system of units?

The error message boils down to:

usr/include/boost/units/detail/linear_algebra.hpp:197:48: error: no
type named ‘item’ in ‘struct
1l>, boost::units::list<boost::units::static_rational<1l>,
boost::units::dimensionless_type> >,

also I defined hbar as

struct reduced_planck_constant_base_unit : base_unit<
                 static string name(){return ("reduced Planck constant");}
                 static string symbol() {return ("hbar");}
static const action hbar;

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