public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* std::osteram_iterator<value_type> giving error with GCC 3.2
@ 2005-05-19  6:37 Mohit Kumar
  2005-05-19 11:41 ` Eljay Love-Jensen
  0 siblings, 1 reply; 2+ messages in thread
From: Mohit Kumar @ 2005-05-19  6:37 UTC (permalink / raw)
  To: gcc-help

 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: std::osteram_iterator<value_type> giving error with GCC 3.2
  2005-05-19  6:37 std::osteram_iterator<value_type> giving error with GCC 3.2 Mohit Kumar
@ 2005-05-19 11:41 ` Eljay Love-Jensen
  0 siblings, 0 replies; 2+ messages in thread
From: Eljay Love-Jensen @ 2005-05-19 11:41 UTC (permalink / raw)
  To: Mohit Kumar, gcc-help

Hi Mohit,

Your code example did not work (reproduce the problem you are experiencing) on my system.

So I added at the top:
#include <ostream>
#include <iterator>

Then when I compiled it worked.

Could you submit a complete, small compilable example that exhibits the problem you are experiencing?

Thanks,
--Eljay

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-05-19 11:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-19  6:37 std::osteram_iterator<value_type> giving error with GCC 3.2 Mohit Kumar
2005-05-19 11:41 ` Eljay Love-Jensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).