Optional Template parameter

后端 未结 2 893
夕颜
夕颜 2020-12-15 04:24

Is it possible to have optional template parameter in C++ , for example

template < class T, class U, class V>
class Test {
};

Here I

2条回答
  •  执念已碎
    2020-12-15 04:51

    You can have default template arguments, which are sufficient for your purposes:

    template
    class Test
    { };
    

    Now the following work:

    Test a;           // Test
    Test b; // Test
    

提交回复
热议问题