15 Feb
2005
15 Feb
'05
10:11 p.m.
David Abrahams wrote:
Ben Hutchings
writes: Actually it can:
struct D : C { void foo(std::string); };
mem_fun mf = static_cast
(&D::foo); Not that I'd recommend doing that, as it invites type errors.
Creating an instance by breaking the type system is cheating.
That doesn't break the type system. The result is well-defined; see 5.2.9/9 in the standard.
Why not reinterpret_cast
("foo"), for that matter?
That's ill-formed.
A simpler instance of the type is:
mem_fun mf = 0;
Yes, and as you know that's what the type trait relies on. Ben.