Boost logo

Boost :

From: Andrey Semashev (andysem_at_[hidden])
Date: 2007-08-01 16:24:37


Hello Eric,

Wednesday, August 1, 2007, 11:17:12 PM, you wrote:

> Interesting. I guess the conversion to member pointer also works for
> member function pointers on compliant compilers. I notice that the
> following program doesn't compile with gcc 3.4 though:

> struct nullptr_t
> {
> template<typename T>
> operator T*() const { return 0; }

> template<typename T, typename U>
> operator T U::*() const { return 0; }
> };

> const nullptr_t nullptr = {};

> struct A {};

> int main()
> {
> A *p1 = nullptr;
> void (*p2)() = nullptr;
> int (A::*p3) = nullptr;
> int (A::*p4)() = nullptr;
> }

I'm surprised too. I always though that T U::* and T (U::*)() are
very different types. I didn't find in the Standard any notes that they
are the same.

-- 
Best regards,
 Andrey                            mailto:andysem_at_[hidden]

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