Topic: Ptr to member why no implicit conversion...
Author: rogero@howzatt.demon.co.uk ("Roger Orr")
Date: Mon, 21 Oct 2002 17:08:14 +0000 (UTC) Raw View
"Richard Corden" <richards_corden@hotmail.com> wrote in message
news:83zntee5xk.fsf@leinster.programmingresearch.ie...
>
> Can someone please explain to me why there is no implicit conversion
> to ptr to member for member functions as there is for non members or
> static functions.
>
Stroustrup addresses this in 'Design and Evolution of C++'
IIRC he didn't want to allow any shortcuts in the syntax since he thought
use of pointer-to-members should always stand out...and unambiguous syntax
helps.
I don't believe there is a technical reason.
Roger Orr
--
MVP in C++ at www.brainbench.com
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
Author: richards_corden@hotmail.com (Richard Corden)
Date: Wed, 16 Oct 2002 17:36:46 +0000 (UTC) Raw View
Can someone please explain to me why there is no implicit conversion
to ptr to member for member functions as there is for non members or
static functions.
<CODE>
struct A
{
void foo ();
};
void bar (void (A::*pf)());
bar (A::foo); // error
</CODE>
Some of the compilers I've tried will generate a warning and continue
(normally saying adding '&'). Is there an example where implicitly
adding the '&' causes problems?
Thanks for your time.
Richard
--
Richard Corden
To reply remove 's' from address
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]