Boost logo

Boost :

From: Marco (mrcekets_at_[hidden])
Date: 2007-10-09 07:10:02


On Tue, 09 Oct 2007 08:41:14 +0200, Marco Costalba <mcostalba_at_[hidden]>
wrote:

>
> I've tried to understand why it seems strange to me the proposed
> operator=() for assigning functions to overload:
>
> void foo1();
> int foo2(int);
>
> overload f;
> f = &foo1;
> f = &foo2;
>
> I came to the conclusion that all boils down to transitive property of
> equality. In other words until childhood we are teached that
>
> If a == b and b == c, then a == c
>
> 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.
>
> Marco

I consider operator=() misleading, too. I guess that for &foo1 != &foo2
you mean that their types are not convertible between each other.

Marco

-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

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