ftp.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/06/16:46:05

From: kevin AT reality-bytesX DOT demon DOT co DOT uk (Kev)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Help I'm Looping ...
Date: Sat, 06 Jun 1998 20:10:02 GMT
Message-ID: <3579a1d6.22508781@news.demon.co.uk>
References: <35794D51 DOT D49BABED AT BigPond DOT com>
NNTP-Posting-Host: reality-bytes.demon.co.uk
Lines: 51
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On Sun, 07 Jun 1998 00:08:18 +1000, Dominique Louis
<Dominique_Louis AT BigPond DOT com> wrote:

>Hi all,
>I've spent the last few hours looking at the following code and can't
>work out why it's looping.
>Basically the function returns a list of all Nodes that are reachable
>from a particular Node.
>I don't think the fact that I'm using templates has anything to do with
>it, but maybe it has ( that's why I'm posting this message, I'm not sure
>of anything right now ).
>If you've got a spare 5 minutes please check it for me.
>The code is as follows....
>
>list< Node > reachable( Node reachVertice )
>    {
>      list< Node > x, x1;
>      list< Edge > :: iterator i;
>
>      cout << "reachable";
>      for( i = EdgeList.begin( ); i != EdgeList.end( ); i++ )
>      {
>        if( ( i->getFrom( ) == reachVertice )  );		
>        {
>          x.push_back( i->getTo( ) );
>          x1 = reachable( i->getTo( ) );
>          if( !x1.empty( ) )
>          {
>            x.splice( x.end( ), x1 );
>            x.sort( );
>            x.unique( );
>          }
>        }
>      }
>      return x;
>    }
>
>
>thanks in advance,
>
>
>Dominique Louis.
>===========================================================
>To Do Nothing is to Collaborate with the oppressor!
>===========================================================
>
>

Did you want the semicolon after the line  
if( ( i->getFrom( ) == reachVertice )  );   ?
Kev

- Raw text -


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