|
Boost : |
From: Dean Michael Berris (mikhailberis_at_[hidden])
Date: 2007-10-09 03:27:35
On 10/8/07, Joel de Guzman <joel_at_[hidden]> wrote:
> Marco Costalba wrote:
> >
> > Because the following line
> >
> > if (a = b) // here = instead of == is intended
> > assert(a==b);
> >
> > should never fail for any properly defined operator=() and
> > operator==() it derives that operator=() as proposed for our overload
> > does not satisfy the above very intuitive concepts (because &foo1 !=
> > &foo2) so I would say it cannot be called 'idiomatic' for this case.
>
> Yep. Agreed. See my other post why I am convinced your intuition
> is correct :-) No need to convince me more ;)
>
How about 'register' instead of 'add' or 'assign' ?
overloads<void(int), void(std::string)> functions;
functions.register(&foo1);
functions.register(&foo2);
?
This way we can also have something like:
functions << register(&foo1)
<< register(&foo2);
?
The above suggestion follows the notion of directives, which are being
passed to an object to invoke some sort of behavior. This might be
similar to something like:
std::cout << std::endl;
-- Dean Michael C. Berris Software Engineer, Friendster, Inc. [http://cplusplus-soup.blogspot.com/] [mikhailberis_at_[hidden]] [+63 928 7291459] [+1 408 4049523]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk