Name: Anonymous 2009-12-12 22:32
Hello.
In C++, I'm using an iterator to iterate through a vector of pointers.
How do I perform operations on the iterator?
I've tried several things but keep getting errors. This is where I get the error:
//In constructor of interface class
d_ClassA.push_back(new Class B(3)); //d_ClassA is a.. //std::vector<ClassA*>
...
//member-function in interface class
...
for (vector<ClassA*>::iterator i = 0; i != d_ClassA.end(); i++) {
string classAFilename= (*i)->getFilename();
...
I guess there could be something else that is wrong. But is the code above correct?
In C++, I'm using an iterator to iterate through a vector of pointers.
How do I perform operations on the iterator?
I've tried several things but keep getting errors. This is where I get the error:
//In constructor of interface class
d_ClassA.push_back(new Class B(3)); //d_ClassA is a.. //std::vector<ClassA*>
...
//member-function in interface class
...
for (vector<ClassA*>::iterator i = 0; i != d_ClassA.end(); i++) {
string classAFilename= (*i)->getFilename();
...
I guess there could be something else that is wrong. But is the code above correct?