Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2003-02-05 09:56:19

Daniel Frey wrote:
> Peter Dimov wrote:
>> Yes, exactly. Apologies for the confusion. It is a common mistake to
>> provide only R T::* and expect that to match all pointers to
>> members. To get back to your earlier post,
>> int (X::*pf) () const;
>> is not the same as
>> typedef int (*F) () const;

Should be typedef int F() const;

>> typedef F X::* pf;
>> since the first typedef is ill-formed, function types cannot be
>> cv-qualified.
> The standard seems to disagree, see 9.3.1/9. Or is it just
> pointers-to-functions against pointer-to-member-functions?

That's 9.3/9, and yes, you are right, the typedef is legal. I learn
something new every day. Even though 3.9.3/1 implies that functions cannot
be cv-qualified, and 8.3.5/4 says that creating a cv-qualified function type
makes the program ill-formed, R T::* still matches a const member function,
creating a const qualified function type as R. Or so Comeau says. C++ sure
moves in mysterious ways.

Boost list run by bdawes at, gregod at, cpdaniel at, john at