Boost logo

Boost :

From: Maarten Kronenburg (M.Kronenburg_at_[hidden])
Date: 2008-03-31 17:13:43


"Giovanni Piero Deretta" wrote in message
> On Mon, Mar 31, 2008 at 9:22 PM, Maarten Kronenburg
> wrote:
> > > >
> > > > Probably you would use conversion operators.
> > >
> > > Not necessarily, you just make your operators templated on the
policy.
> > > No need to do any conversions.
> > >
> > > > But runtime polymorphism allows
> > > > basetype pointers to derived type objects, and still it works
(through
> > the
> > > > vtable). So runtime polymorphism can never be fully replaced by
> > something
> > > > else.
> > >
> > > Of couse you need runtime indirection if you need dynamic indirection
> > > :). But 99.9% of the times you do not need it. When you need it is
> > > easy to add.
> > >
> >
> > I'm not so sure it will be 0.01%. This integer will be used by MANY
users,
> > and you try to explain to a user that it does not work once you use a
base
> > pointer to a derived object.
>
> Uh? Users do not expect to have a base class for integers, why should
> they expect it for multiprecision integers?
> It is a value type, why would you expect to treat it polymorphically?

In my opinion an unsigned integer is a, works like a and can be substituted
as an integer, and so is a modular integer, and as far as I'm concerned also
an allocated integer. This is why I choose for derivation, and then with the
base pointer to derived object (as quoted above) to runtime polymorphism.
And in my opinion an integer is not a container, so I see no reason to use
templates.

>
> > This will be one of the most important classes of C++, and I want it to
work
> > ALWAYS.
> > Therefore in my opinion in this case there is no alternative for
runtime
> > polymorphism.
>
> I'm still far from convinced. But anyways, I'm not the one
> implementing it, so I have little say :)
> At most I'll be able to voice my concerns at review time.
>
See above.
Regards, Maarten.


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