Boost logo

Boost :

From: williamkempf_at_[hidden]
Date: 2001-04-10 08:37:18


--- In boost_at_y..., Doug Gregor <gregod_at_r...> wrote:
> On Monday 09 April 2001 09:48, you wrote:
> [snip]
> > Looks mostly good to me from this posting, but I need to look at
the
> > actual code yet. The only thing that jumps out is the assignment
to
> > int. This would allow code such as the following:
> >
> > any_function func(myfunctor);
> > func = 10; // clears out the target, but this line doesn't make
sense
> >
> > I also worry about possible ambiguities resulting between this
> > assignment and the templated assignment, though I'm not sure what
> > interactions could cause this. I'd lean towards eliminating this
> > assignment entirely, since clear will accomplish the same thing
and
> > is more understandable in any event.
> >
> > Bill Kempf
>
> I've found no problem with ambiguities thus far. So far I'm
outnumbered, but
> I like the ability to say:
>
> any_function<...> func();
> func = 0;
>
> Because it more closely mirrors a normal function pointer. Would a
(runtime)
> assertion change your mind?

The likelyhood of ambiguities is remote at best. The likelyhood of
misuse is greater, though still small. However, any chance for
accidental misuse should be very carefully considered and eliminated
if possible. A runtime assertion would help, but I'd still feel
better if this were just eliminated. The call to clear() just reads
better, has no chance for accidental misuse and is intuitive, while
assignment to 0 may not be.

Bill Kempf


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