$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-users] [mpl, units] rational and static_rational
From: alfC (alfredo.correa_at_[hidden])
Date: 2009-08-17 02:07:07
Hi,
I am looking for a template library that can handle compile time
rationals, ideally with a similar interface to mpl::int_ and that
plays well with boost::rational (the dynamic type).
First I found boost/mpl/math/rational_c.hpp but soon I realized that
it doesn't work with basic operations like mpl::plus, it doesn't even
simplify reducible fractions (i.e. 2/4 -> 1/2), in fact it looks like
it is just the storage of two (static) integers. Is this something
that will be developed in the future or am I using it in the wrong
way?
Then I found boost::units::static_rational which is more promising,
because it simplifies fractions and works with mpl::plus, but it is
not integrated with boost::rational nor has an interface similar to
that of mpl metatypes.
Is there a way of extending mpl::math::rational_c with the existing
libraries in boost, or a simple way to make
boost::units::static_rational have an interface similar to mpl and
also have a value type that returns it runtime boost::rational value?
Thank you,
Alfredo