www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/06/20:15:21

Message-ID: <3579D844.667E49BC@BigPond.com>
Date: Sun, 07 Jun 1998 10:01:09 +1000
From: Dominique Louis <Dominique_Louis AT BigPond DOT com>
Reply-To: Dominique_Louis AT BigPond DOT com
Organization: Savage Software Solutions
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Help I'm Looping ...
References: <35794D51 DOT D49BABED AT BigPond DOT com> <3579a1d6 DOT 22508781 AT news DOT demon DOT co DOT uk>
NNTP-Posting-Host: 139.134.59.187
Lines: 66
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp


Kev wrote:

> 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

No... and that is what has caused me my head-aches. Thanks for taking the
time to look over my code.

Ciao,


Dominique Louis



- Raw text -


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