From: Peter Dimov (pdimov_at_[hidden])
Date: 2004-08-17 15:56:35


Jonathan Turkanis wrote:
> <Arturo_Cuebas_at_[hidden]> wrote in message
> news:OF6215D845.F05336EF-ON86256EF3.005F9390-86256EF3.00613932_at_bpmicro.com...
>
> I can do it with this syntax:
>
> boost::resolve_cast<int()>(&C::g);
> boost::resolve_cast<int(int)>(&C::g);
>
> using function types as in Boost.Function. Your version would be the
> 'portable syntax'.
>
>> Is there a name better than resolve_cast?
>
> Sounds okay to me.
>
>> This was tested only in VC7.1.
>
> You need to add &'s to former member function pointers. Otherwise it
> 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; }

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.