Name: Anonymous 2009-11-20 23:38
$ cat test.cc
#include <iostream>
#include <list>
template <class T>
std::ostream& operator<<(std::ostream& os, const std::list<T*>& list){
std::list<T*>::const_iterator i;
for( i=list.begin(); i!=list.end(); i++) {
os << *i;
}
return os;
}
$ g++ test.cc
test.cc: In function ‘std::ostream& operator<<(std::ostream&, const std::list<T*, std::allocator<T*> >&)’:
test.cc:6: error: expected ‘;’ before ‘i’
test.cc:7: error: ‘i’ was not declared in this scopeI'm too retarded to figure out how to print a list of objects in sepples. Should I just become an hero now, /prog/?