Boost logo

Boost Users :

From: Chris Russell (cdr_at_[hidden])
Date: 2002-09-18 15:04:24


Hi Jim, the problem here is that when using the generic BGL algorithms,
there's no explicit way to feed control information (e.g. stop - I found
what I need) back to the algorithm that is sequencing through the graph and
dispatching "events" into your visitor code. I'm guessing the lack of such a
feedback path in the first several algorithms I've looked at is due to the
fact that aborting the algorithm is an atypical requirement?

"Jim.Hyslop" <jim.hyslop_at_[hidden]> wrote in message
news:F5DF799F740CD611802200034722783C7367B7_at_pelican.mars.leitch.com...
> Steve M. Robbins [mailto:steven.robbins_at_[hidden]] wrote:
> > I use that technique to abort the Dijkstra shortest path
> > search when I find my
> > goal node. It works fine, as far as I can tell, but I'd be
> > interested to
> > learn if there is a better way.
> It seems anti-idiomatic to me. Exceptions are intended to signify
> exceptional circumstances that you would not normally expect to encounter
> (at least according to one school of thought).
>
> An exception tells me "Oops, something went wrong here" not "we succeeded,
> here's the answer". Many of the exceptions I catch are called "oops":
>
> try { /* ... */ }
> catch (std::exception &oops)
> { /* ... */ }
>
> One possible snag might be if your code interacts with someone else's
code,
> which will catch the exception and not pass it on to you. In the context
> we're talking about, though, I don't see that as a significant problem.
>
> An exception is certainly an easy way to abort the search, and since I
don't
> have an alternative to offer, I'll shut up now ;=)
>
> --
> Jim
>


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net