compile error extending std list

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <list>
using namespace std;

template<typename T>
class mylist : public list<T> {
    typedef list<T> super;
public:
    void my_pop_front() {
        pop_front();
    }
};

int main() {
}

since the superclass method should be available for the derived class,
and pop_front() is a method of list
why compile error?
I don't understand what the error mean:
G:\workspace\test3\test3.cpp: In member function 'void mylist<T>::my_pop_front()
':
G:\workspace\test3\test3.cpp:23:14: error: there are no arguments to 'pop_front'
 that depend on a template parameter, so a declaration of 'pop_front' must be av
ailable
G:\workspace\test3\test3.cpp:23:14: note: (if you use '-fpermissive', G++ will a
ccept your code, but allowing the use of an undeclared name is deprecated)


Thanks in advance.
Don't extend STL classes, they don't provide virtual destructors.
Try this:
1
2
3
    void my_pop_front() {
    	super::pop_front();
    }
oh, I got it
Thanks~
Last edited on
Topic archived. No new replies allowed.