Is there a way to pass template arguments to a function on an object when the object type is a template argument?

前端 未结 1 1704
南旧
南旧 2021-01-13 09:42

To illustrate:

struct MyFunc {

    template 
    void doIt() {
        cout << N << endl;
    }

};

template 

        
相关标签:
1条回答
  • You have to tell the compiler that doIt will be a template:

    f.template doIt<123>();
    
    0 讨论(0)
提交回复
热议问题