|
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
Hi,
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
boost::units::list<boost::units::list<boost::units::static_rational<0l,
1l>, boost::units::list<boost::units::static_rational<1l>,
boost::units::dimensionless_type> >,
boost::units::dimensionless_type>::next
also I defined hbar as
struct reduced_planck_constant_base_unit : base_unit<
reduced_planck_constant_base_unit,
action_dimension,
3
>{
static string name(){return ("reduced Planck constant");}
static string symbol() {return ("hbar");}
};
static const action hbar;
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