F
Frank Steinmetzger
Hello group,
I have a small program that has been written using Visual Studio. However, I
work with Linux and GCC. During porting I encountered a little problem that
I don't know how to solve. I should add that STL is pretty new to me ATM.
There is a class "cc":
template <int Dimension, typename ftype> class cc;
And a class "database", which holds a vector of cc:
template <int Dimension, typename ftype> class database {
[...]
private:
static std::vector<cc<Dimension, ftype>*> list;
}
The following is located in the destructor of database:
template <int Dimension, typename ftype>
database<Dimension, ftype>::~database()
{
[...]
for (std::vector<cc<Dimension, ftype>*>::iterator it = list.begin();
it!= list.end(); it++)
delete *it;
[...]
}
When compiling this, I get this error:
Curve.cpp: In destructor 'database<Dimension, ftype>::~database()':
Curve.cpp:630: error: expected `;' before 'it'
Curve.cpp:630: error: 'it' was not declared in this scope
(Line 630 is the one with the for loop).
For testing, I used std::vector<int*>::iterator in the loop and the error
disappeared. Hence cc<Dimension, ftype>* seems to be unknown or not
accepted as a template type for the vector, but how and why? Could you
please give me some advice?
Thanks in advance.
I have a small program that has been written using Visual Studio. However, I
work with Linux and GCC. During porting I encountered a little problem that
I don't know how to solve. I should add that STL is pretty new to me ATM.
There is a class "cc":
template <int Dimension, typename ftype> class cc;
And a class "database", which holds a vector of cc:
template <int Dimension, typename ftype> class database {
[...]
private:
static std::vector<cc<Dimension, ftype>*> list;
}
The following is located in the destructor of database:
template <int Dimension, typename ftype>
database<Dimension, ftype>::~database()
{
[...]
for (std::vector<cc<Dimension, ftype>*>::iterator it = list.begin();
it!= list.end(); it++)
delete *it;
[...]
}
When compiling this, I get this error:
Curve.cpp: In destructor 'database<Dimension, ftype>::~database()':
Curve.cpp:630: error: expected `;' before 'it'
Curve.cpp:630: error: 'it' was not declared in this scope
(Line 630 is the one with the for loop).
For testing, I used std::vector<int*>::iterator in the loop and the error
disappeared. Hence cc<Dimension, ftype>* seems to be unknown or not
accepted as a template type for the vector, but how and why? Could you
please give me some advice?
Thanks in advance.