Wednesday, July 18, 2012

template function used as non typename template parameter

In vs

template<typename T,void (T::*m)(int)>
struct B{
void f(T* a,int x){

struct A{

   template<typename X> void f(int){

   void wrap(int i){

   B<A,&A::wrap > x;
   B<A,&A::f<char> > y;

int main(){
   A a;

====compiler output====

c:\users\fabio\dropbox\vs\testbug\testbug.cpp(20): error C2440: 'specialization' : cannot convert from 'overloaded-function' to 'void (__thiscall A::* )(int)'
          None of the functions with this name in scope match the target type


  B<A,&f<char> > y;

No comments:

Post a Comment