Boost logo

Boost :

From: helmut.zeisel_at_[hidden]
Date: 2001-08-24 02:44:35


--- In boost_at_y..., Jens Maurer <Jens.Maurer_at_g...> wrote:
> helmut.zeisel_at_a... wrote:
> > A user of my big_int implementation asked me if
> > I could add implicit conversion to less precise integral types.
>
> No.
>

I agree.

In the meanwhile I realized that
what he really wants is a conversion to bool,
which is false for zero and true for non-zero,

i.e., he wants to write code like

unlimited n;
...
while(n) {...}

This sounds reasonable to me.
If I provide an implicit conversion to bool only, however,
I will also have an implicit conversion to
all the other built-in types with confusing semantics:

unlimited n=12345;
float x=n; // x will be 1

So I consider just providing a conversion to bool
and making the all the other conversion operators to
built-in types private and undefined.

Comments?

Helmut


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