c++ - Passing a template to deque -


i'm trying write container class deque make circular buffer (using deque important here since class replacing vector , need used 1 here). don't want have make container class specific specific deque; is, want class template class , deque templated type. however, code gives me use of undefined type errors when compiles (c:\program files (x86)\microsoft visual studio 10.0\vc\include\deque(795): error c2027: use of undefined type 'dequeclass').

the code:

#pragma once  #include <deque>  template<typename dequeclass> class circulardeque { public:     circulardeque(int newmax);     ~circulardeque();     void push_front(dequeclass&& val);     void push_front(const dequeclass& val);     void push_back(dequeclass&& val);     void push_back(const dequeclass& val);     std::deque<dequeclass> que;     int getmax();     void setmax(int newmax); private:     unsigned int max; };  circulardeque<class dequeclass>::circulardeque(int newmax) {     max = newmax; }  void circulardeque<class dequeclass>::push_front(dequeclass&& val) {     que.push_front(val);     if(que.size() > max) {         que.pop_back();     } }  void circulardeque<class dequeclass>::push_front(const dequeclass& val) {     que.push_front(val);     if(que.size() > max) {         que.pop_back();     } }  void circulardeque<class dequeclass>::push_back(dequeclass&& val) {     que.push_back(val);     if(que.size() > max) {         que.pop_front();     } }  void circulardeque<class dequeclass>::push_back(const dequeclass& val) {     que.push_back(val);     if(que.size() > max) {         que.pop_front();     } }  int circulardeque<class dequeclass>::getmax() {     return max; }  void circulardeque<class dequeclass>::setmax(int newmax) {     max = newmax; } 

anyone know can here?

each inline member of template class must prefaced template parameter list. ie. this:

circulardeque<class dequeclass>::circulardeque(int newmax) {     max = newmax; } 

should this:

template<class dequeclass> circulardeque<dequeclass>::circulardeque(int newmax) {     max = newmax; } 

do of out-of-class definitions.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -