Boost logo

Boost Users :

Subject: Re: [Boost-users] [units] Creating specific unit quantities
From: Ryan (mccorywork_at_[hidden])
Date: 2011-03-16 17:25:43


On Mon, Mar 7, 2011 at 5:35 PM, Matthias Schabel
<boost_at_[hidden]>wrote:

> #include <boost/units/quantity.hpp>
> #include <boost/units/systems/si.hpp>
> #include <boost/units/base_units/us/foot.hpp>
>
> using namespace boost::units;
>
>
> class Test {
> public:
> // takes any unit of length
> template<class System>
> void setX(quantity<unit<length_dimension,System> > const& x) {
> // explicit conversion to si::length = meters
> m_X = quantity<si::length>(x);
> }
> private:
> quantity<si::length> m_X;
> };
>

void setY(quantity<unit<???, System> > const& y) {
  m_Y = quantity<si::dimensionless>(y);
}

I would like to be able to accept any systems dimensionless quantity. Since
dimensionless isn't a physical system I obviously didn't find a tag I could
use like length_dimension. What should I do here?

Ryan



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