Boost logo

Boost Users :

From: Andy Little (andy_at_[hidden])
Date: 2006-08-15 15:42:38


Hi Eric,

"Eric Lemings" <lemings_at_[hidden]> wrote in message
news:D730FF7CEDDCA64483F9E99D999A158B41FC86_at_qxvcexch01.ad.quovadx.com...
Hi,

I'm looking for a metafunction like this:

template <
  class N1, class D1,
  class N2, class D2 >
struct times {
  typedef ... numer;
  typedef ... denom;
};

N1, D1, N2, and D2 are all MPL integral constant wrappers. The numer
member of the times metafunction is the numerator N of the ratio
(preferably in reduced form) produced by (N1/D1) * (N2/D2) = (N/D).
Likewise, the denom member is the denominator D of the ratio produced
from this equation.

FWIW Quan http://sourceforge.net/projects/quan has a rational type, you could
use as a basis. there is also the mpl_math package in the boost vault, in
Template Metaprogramming section I think

regards

Andy little


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