KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Suppose you have struct A{ void f(){} }; struct B:public A{ }; template<typename C,void (C::*f)()> struct Call{ void operator()(C* c){ (c->*f)(); } }; why does int main(){ void (B::*f)()=&B::f; } work but Call<B,&B::f> a; doesn't, complaining could not convert template argument ‘&A::f’ to ‘void (B::*)() ? ( Call<A,&A::f> clearly works) In a similar way const void (B::*f)()=&B::f; gives cannot convert ‘void (A::*)()’ to ‘const void (B::*)()’ in initialization
Tags (comma-separated)
Save Edits
Cancel