B
Bruce Lee Roy
Hi, I am using visual studio.net and I am having problems using this bit
of code when I create an instance,
////////////////////////////////////////////
template<class T>
class matrix : public vector<T> {
public:
matrix(size_t h, size_t w) : vector(h*w), width(w) {}
reference operator()(int i, int j) { return (*this)[i*width+j]; }
const_reference operator()(int i, int j) const { return (*this)
[i*width+j]; }
protected:
size_t width;
};
//////////////////////////////////////////////
error C2955: 'std::vector' : use of class template requires template
argument list : see declaration of 'std::vector'
while compiling class-template member function 'matrix<T>::matrix
(size_t,size_t)'
with
[
T=Point
]
: see reference to class template instantiation 'matrix<T>' being
compiled
with
[
T=Point
]
error C2614: 'matrix<T>' : illegal member initialization: 'vector' is not
a base or member
with
[
T=Point
]
of code when I create an instance,
////////////////////////////////////////////
template<class T>
class matrix : public vector<T> {
public:
matrix(size_t h, size_t w) : vector(h*w), width(w) {}
reference operator()(int i, int j) { return (*this)[i*width+j]; }
const_reference operator()(int i, int j) const { return (*this)
[i*width+j]; }
protected:
size_t width;
};
//////////////////////////////////////////////
error C2955: 'std::vector' : use of class template requires template
argument list : see declaration of 'std::vector'
while compiling class-template member function 'matrix<T>::matrix
(size_t,size_t)'
with
[
T=Point
]
: see reference to class template instantiation 'matrix<T>' being
compiled
with
[
T=Point
]
error C2614: 'matrix<T>' : illegal member initialization: 'vector' is not
a base or member
with
[
T=Point
]