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

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

To illustrate:

struct MyFunc {

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

};

template 

        
1条回答
  •  不要未来只要你来
    2021-01-13 10:42

    You have to tell the compiler that doIt will be a template:

    f.template doIt<123>();
    

    0 讨论(0)
提交回复
热议问题