On 1/7/07, Peter Dimov <pdimov@mmltd.net> wrote:
Server Levent Yilmaz wrote:

This definitely sounds like a compiler bug. But your code isn't quite
standard-conforming. You ought to use a pointer to member, not
reinterpret_cast tricks.



Hi Peter,

My concerns about the sample code not being quite right was actually not this reinterpret_casts (though, I do agree that they are a bit fishy -- please see next paragraph). I was worried about temporary lambda expressions and function objects being carried around to other scopes. I can not quite see if this valid or not..

As a side discussion, well it is kind of off topic but now that you brought it up, there was a case where I couldn't get away with using member pointers and needed this pointer algebra. I'd appreciate any idea on this. The problem is simple. Take this struct,

struct A { double a[3]; }

For, this I needed to callback, say, a[2].  A callback facility designed with member pointers wouldn't be able to handle this case.  Right?


--
Server Levent Yilmaz
Mechanical Engineering @ PITT