default argument for template parameter for class enclosing

后端 未结 2 1301
终归单人心
终归单人心 2021-02-12 11:21

code:

template  >
class stack
{
    public:
        stack() {}
        temp         


        
2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-12 11:50

    You attempt to provide a default argument for the second template parameter to stack twice. Default template arguments, just like default function arguments, may only be defined once (per translation unit); not even repeating the exact same definition is allowed.

    Just type the default argument at the beginning where you define the class template. After that, leave it out:

    template
    bool stack::empty(){
        return container.empty();
    }
    

提交回复
热议问题