
"Peter Dimov" <pdimov@mmltd.net> wrote in message news:004101c4849c$b074dd70$0600a8c0@pdimov...
Jonathan Turkanis wrote:
<Arturo_Cuebas@bpmicro.com> wrote in message
news:OF6215D845.F05336EF-ON86256EF3.005F9390-86256EF3.00613932@bpmicro.com...
I can do it with this syntax:
boost::resolve_cast<int()>(&C::g); boost::resolve_cast<int(int)>(&C::g);
looks okay to me. My version works on VC7.1, Como 4.3.3 and GCC 3.2. I'll post it if there's interest.
template<class F, class X> F X::* resolve_cast( F X::* pm ) { return pm; }
Very cool.
looks like it ought to work. VC 7.1 doesn't like it, though. Neither does GCC 3.2.3.
:(
The online Comeau compiles it.
Intel 8.0 for windows, too. I fixed my version, which seems to be reasonably portable (it needs SFINAE and a certain amount of support for function types). It consists of an overload for each arity, the first of which looks something like this: template<typename Sig, typename C> [ typename result_type<Sig>::type (C::*)() ] resolve_cast( result_type<Sig>::type (C::*f)(), typename enable_if< Sig has arity 0 >::type* = 0) { return t; } Jonathan