ok. So i'm having a little problem iterating through a list of mine.
1 2 3 4 5 6 7 8 9 10 11
typedef std::list<item*> inventory;
...
//prints the contents of an inventory.
void printInv(inventory* const inv){
for (std::list<item*>::iterator iter=inv->begin();
iter <= inv->end; ++iter)
puts((*iter)->getName());
}
so i want printInv takes a pointer to a constant inventory (std::list<item*>) and then trys to iterate throught it, putting the string returned from the items getName() on the screen.
and i get the error
1 2
src/renderer/renderer.cpp: In function ‘void printInv(inventory*)’:
src/renderer/renderer.cpp:31: error: no match for ‘operator<=’ in ‘iter <= ((inventory*)inv)->std::list<_Tp, _Alloc>::end [with _Tp = item*, _Alloc = std::allocator<item*>]’
so in the second line of the for statement its complaining about my use of <=.
if i change it to != then it just complains about 'operator!='.