Iterators

Hello,
I'm trying to make use of iterators in my linked list. I've read up on them but never used them. I thought I was declaring this right but apparently not:
1
2
3
4
5
6
7
8
9
10
11
#include <list>
#include "Accounts.h"
using namespace std;

int main
   {
   list<Accounts> Accounts;

   list<Accounts>::iterator it;
   return 0;
   }


From what I understand, the iterator class should be included with the list class. This list is a list of Account objects which i've created. When I try to create the iterator my compiler (Dev C++ on Windows XP) gives me the following error:

"type/value mismatch at argument 1 in template parameter list for template<class_Tp, class_Alloc> class std::list"
"expected a type, got Accounts"
"template argument 2 is invalid"
"iterator does not name a type"

Can anyone tell me what I'm doing wrong?

Thanks!


Before line 7, 'Accounts' refers to a type. After line 7, 'Accounts' refers to a list declared on line 7.

'Accounts' is probably a misnomer for the class. Maybe 'Account' would be more appropriate.
Last edited on
Thanks. Makes sense that would be the problem. I changed the name and it fixed it.
Topic archived. No new replies allowed.