Boost logo

Boost :

From: scleary_at_[hidden]
Date: 2001-01-25 08:54:54


> Of course,
> there is a problem if someone wants to use boost::rational with an
> unlimited set of IntTypes, but boost::rational really isn't designed
> for such use (e.g. there are no operators that allow
> comparison between
> rationals with different underlying IntTypes), so I don't
> think we need
> to worry about this.

We aren't talking about allowing "different underlying IntTypes" here.
We're talking about allowing IntType to be an instance class of a template
type.

Hypothetical situation:

Future Boost library "Numeric" provides a template class "bit_int<unsigned
N>", which will act exactly like an N-bit 2s-complement integer.

Since bit_int<N> is a template class, it *can't* overload std::swap, thus
rational<bit_int<13> > cannot call the proper swap function.

If we *don't* worry about this, the only way users can have properly
efficient code is to specialize std::swap for each value of N that they use
in their code. Ugly, to say the least. :)

        -Steve


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk