Boost logo

Boost :

Subject: Re: [boost] [Review] Boost.Ratio
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2010-10-08 18:16:32

----- Original Message -----
From: "joel falcou" <joel.falcou_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Friday, October 08, 2010 10:38 PM
Subject: [boost] [Review] Boost.Ratio

> So here is my review of Boost.Ratio
> *- What is your evaluation of the design?*
> It's a strictly (or at least as struct as possible) implementation of
> the standard proposal. Code is clear
> and easily followed.
> *- What is your evaluation of the implementation?*
> It's very OK and straightforward. I'll reiterate the question about
> providing
> MPL or Fusion adaptors as an optional features (unless I missed them :x)

I remember the thread for MPL. I will try to recall it here :

The idea is to specialize mpl arithmetic operation for ratio. As Ratio is not a Integral Constants we need to define a new on, let me call it Rational Constant. What could be the requirements for a Rational Constant?

Expression Type Complexity
r::tag rational_c_tag Constant time.
r::value_type A boost::rational<integral_type> type Constant time.
r::num An integral constant expression Constant time.
r::den An integral constant expression Constant time.
r::type Rational Constant Constant time.
r::value_type c = r.value() R::value_type Constant time.

Expression Semantics
r::tag r's tag type; n::tag::value is n's conversion rank.
r::num The value of the numerator integral constant.
r::den The value of the denominator integral constant.
r::type 'is_equivalent'<r::type,r>::value == true.
c=r.value() c.numerator() * r::den == c.denominator() * r::num.

I could implemented this, but before doing it I will want to heard the maintainers of MPL about this feature and if they will accept to include it in his library.

Respect to fusion adaptors, I don't see what can be done. Could detal a little bit more?

> *- Did you try to use the library? With what compiler? Did you have any
> problems? *
> I tried it using gcc 4.4 and 4.5 and icc 11. No problem so far.

Thanks. I will add icc 11 to the list of comilers.
> *- How much effort did you put into your evaluation? A glance? A quick
> reading? In-depth study? *
> I quickly glanced over the code as I knew it from its inception and
> followed it so I only had to look some
> new stuff. I tried some non trivial task , including some attempt at MPL
> like CT linear system
> solver using rational. boost.ratio proved itself useful in this task.

I will be glad to see how you applied ratio. Could you share?
> *- Do you think the library should be accepted as a Boost library?*
> Yes

Thanks Joel.

Boost list run by bdawes at, gregod at, cpdaniel at, john at