Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Sepples is super hard

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 scope

                                                         
I'm too retarded to figure out how to print a list of objects in sepples. Should I just become an hero now, /prog/?

Name: Anonymous 2009-11-21 0:03

I don't even know much SEPPLES, but the following is pretty obviously strange, if not wrong:
i=list.begin(); i!=list.end(); [b]i++[/b]
and does dereferencing i really does what you think it does?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List