[units] quantities with system abstraction "any<length>"
Hi,
In order to avoid reinventing the wheel I was wondering if there is
any effort or there was any attempt to further abstract
boost::units::quantities from its unit system but with a given
dimension. That is, an object that can hold any
boost::units::quantity
AMDG On 10/6/2010 1:31 AM, alfC wrote:
In order to avoid reinventing the wheel I was wondering if there is any effort or there was any attempt to further abstract boost::units::quantities from its unit system but with a given dimension. That is, an object that can hold any boost::units::quantity
> with a given Dimension fir any System.
No. Boost.Units is strictly compile-time.
For example (names are not ideal)
any
a1 = 2.*si::meter; // RHS is type quantitysi::length any a2 = 2.*cgs::centimeter; //RHS is type quantitycgs::length any b1 = 2.3 * si::second; // ERROR. or can hold any other quantity with length dimension (from any system). A sort of boost::variant
, quantity , ...>, (but since the list is of type is not well defined maybe variant is not an options.) I know that there are some unresolved issues, for example, what is the result of a1 + a2, for which I have some solutions in mind. Anyway I just was wondering if this was tried before. And if not, what would be the best way to achieve it (boost::any? boost::variant?). (Note that all quantity<Unit> types has always the sizeof a double.)
In Christ, Steven Watanabe
participants (2)
-
alfC
-
Steven Watanabe