I'm lost as to what is wrong here, can anyone give me a hand?
Code:
#include <vector>
using namespace std;
template<typename kind>class visVector:public vector<kind>{
public:
visVector(int basex, int basey);
kind operator[](int index);
kind at(int loc);
void push_back(kind);
private:
int bx, by;
};
template<typename kind>
visVector<kind>::visVector(int basex, int basey){
bx = basex;
by = basey;
}
template<typename kind>
kind visVector<kind>::operator[](int index){
return vector::at(index);
}
template<typename kind>
kind visVector<kind>::at(int index){
return vector::at(index);
}
template<typename kind>
void visVector<kind>::push_back(kind toBeAdded){
//need to locate where we're pushing onto, then highlight that section
vector::push_back(toBeAdded)
}
int main(int argc, char* argv){
visVector<int> v;
for(int i = 0; i < 10; i++)
v.push_back(i);
for(int i = 0; i < v.size(); i++)
cout << v[i] << ", ";
cout << endl;
for(int i = 0; i < v.size(); i++)
v[i] = v[i] * 10; // Assignment
for(int i = 0; i < v.size(); i++)
cout << v[i] << ", ";
cout << endl;
}
I'm getting the error code in g++:
Quote:
visVector.cpp: In member function `kind visVector<kind>: perator[](int)':
visVector.cpp:22: error: use of class template `template<class _Tp, class
_Alloc> class std::vector' as expression
|
I have no idea what this means. Anyone?
Thanks