G
Gaijinco
This code doesn´t compile:
template <typename T>
ostream& operator<<(ostream& out, const list<T>& l) {
list<T>::iterator it = l.begin();
while(it != (l.end() - 1)) {
out << *it << " ";
++it;
}
if(l.size() > 0) {
out << *it;
}
return out;
}
My compiler says: "expected ';' before it"
Why I'm doing wrong?
Thanks.
template <typename T>
ostream& operator<<(ostream& out, const list<T>& l) {
list<T>::iterator it = l.begin();
while(it != (l.end() - 1)) {
out << *it << " ";
++it;
}
if(l.size() > 0) {
out << *it;
}
return out;
}
My compiler says: "expected ';' before it"
Why I'm doing wrong?
Thanks.