Boost logo

Boost :

Subject: [boost] Fwd: [Boost-users] [units] combined systems and prefixes and output
From: Matthias Schabel (boost_at_[hidden])
Date: 2011-07-14 12:43:27


Can you include your atomic.hpp?

Matthias

> From: alfC <alfredo.correa_at_[hidden]>
> Date: July 6, 2011 1:16:11 PM PDT
> To: boost-users_at_[hidden]
> Subject: [Boost-users] [units] combined systems and prefixes and output
> Reply-To: boost-users_at_[hidden]
>
> 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 mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk