std::osteram_iterator<value_type> giving error with GCC 3.2

Mohit Kumar mohit.kumar@gmail.com
Thu May 19 06:37:00 GMT 2005


 I am getting a certain error while compiling the code below under GCC3.2:

    template <class Cont>
    struct IterRange
    {
    	typedef typename Cont::iterator iterator;
        IterRange(iterator fst, iterator lst) : first(fst), last(lst) {}
		~IterRange() {}
		
        typename Cont::iterator  first;
        typename Cont::iterator  last;
    };

    template <class Cont>
    std::ostream& operator<<(std::ostream& s, const IterRange<Cont>& range)
    {
        typedef typename Cont::value_type value_type;
        std::copy(range.first, range.last,
std::ostream_iterator<value_type>(s, ", "));   <<<<<<<<<<<<<<< Error
Line
        return s;
    }

The error on the line indicated says : parse error before token '>'

I had checked through various codes on net, and they showed the same
syntax. Moreover, the same piece of code executes perfectly on VC++.
What should I do?
Am I missing something? 

Thanks,
Mohit
 
I don't know the key to sucess, but the key to faliure is to try to
please everyone.
-- Bill Cosby



More information about the Gcc-help mailing list