cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1999/04/26/15:05:26

From: Dag Henriksson <dag DOT henriksson AT quidsoft DOT se>
Newsgroups: comp.lang.c++,comp.os.msdos.djgpp
Subject: Re: templated operator<< question
Date: Mon, 26 Apr 1999 12:35:07 +0100
Organization: Quidsoft AB
Lines: 22
Message-ID: <37244F6B.550D16@quidsoft.se>
References: <SuPU2.8517$XT1 DOT 392824 AT newse1 DOT midsouth DOT rr DOT com>
NNTP-Posting-Host: slecan116.eca.ericsson.se
Mime-Version: 1.0
X-Mailer: Mozilla 4.03 [en] (WinNT; I)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

> template <class A>
> ostream& operator<<(const sset<A>& src, ostream & os)
> {
> set<A>::iterator p = src.begin();
> while(p!=src.end())
>   {
>   os << *p << " ";
>   }
> return os;
> };

Seems like you have the wrong order of your parameters.

template <class A>
ostream& operator<<(ostream & os, const sset<A>& src )

looks better.

BTW
The while loop will never end.  You missed a p++.

-- Dag Henriksson

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019