Yet again I find myself struggling with the C++ syntax.
I'm trying to iterate over a list of generic objects. That is I have objects of a class
Event<Q>
, crammed into a std::list<Event<Q> >
.
So I'm trying to get an iterator over the list and intuitively thought that
std::list<Event<Q> >::iterator it;
for (it = events.begin(); it != events.end(); it++) { ... }
should solve the problem. However, i keep getting these errors:
..\calendar.h:48: error: expected `;' before "it"
..\calendar.h:49: error: `it' was not declared in this scope
Is there a reason for it being this difficult?