Boost logo

Boost Users :

Subject: Re: [Boost-users] [Units]
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2017-10-05 04:29:22


AMDG

On 10/04/2017 07:58 PM, CD Clark via Boost-users wrote:
> <snip>
> // centimeter
> namespace t { typedef make_scaled_unit< si::length, scale< 10,
> static_rational<-2> > >::type cm; }
> namespace i { BOOST_UNITS_STATIC_CONSTANT( cm, t::cm ); }
>
> <snip>
>
> // centimeter squared
> namespace t { typedef multiply_typeof_helper< cm, cm>::type cm_cm; }
> namespace i { BOOST_UNITS_STATIC_CONSTANT( cm_cm, t::cm_cm ); }
>
> <snip>
> //std::cout << i::cm_cm << std::endl; // this won't compile
>
> <snip>
> If I uncomment the line that tries to print i::cm_cm it won't compile. I
> get an error that says
>
> 'symbol' is not a member of ...
>
> and points at a line that says
>
> str += Begin::item::symbol()
>
> I can't understand why it doesn't work for a product of two scaled units.
>

  The reason that it fails is that the output code
instantiates the default implementation even if
you override it. The problem is that there is
no symbol defined for 10^-4.

In Christ,
Steven Watanabe


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