Boost logo

Boost :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2001-07-11 08:21:26

Hi Randy,

Visitors are passed by value, like function objects in the STL. So if you
want to get state back out after the algorithm completes, you need to hold
the state by pointer or reference in the visitor.


P.S. The pass-by-reference inside of DFS is for optimization reasons, not

On Wed, 11 Jul 2001 rmhenne_at_[hidden] wrote:

> Howdy,
> I am working with the boost graph library. I am performing a dfs
> with a visitor that has additional state other than the visitor event
> points. At the end of the traversal, my visitor loses this state. I
> think this is because the visitor object is sometimes passed by
> reference and sometime by value. I am running VC++ 6.0 and boost lib
> 1.23.0. Although I know that there are some problems with the VC6.0
> compiler, I thought this problem might be something simpler (like
> me) ).
> My first guess is that my visitor is copied by value (either
> when passed to one of the implementation calls or when it is wrapped
> as a named parameter), builds state during the traversal, and then
> loses this state when it is poped off the stack. The first
> definition of depth_first_search_impl passes the visitor by ref but
> later functions pass by value. I haven't explored this very deeply
> here and I may be doing something very stupid. I am tracing this
> further but since I'm new to boost, I thought some of you experts
> might set me straight quicker. Has anyone had similar problems or is
> this my own doing?
> Thanks for any help,
> Randy Henne
> rmhenne_at_[hidden]
> Info: Unsubscribe: <mailto:boost-unsubscribe_at_[hidden]>
> Your use of Yahoo! Groups is subject to

 Jeremy Siek www:
 Ph.D. Candidate, IU B'ton email: jsiek_at_[hidden]
 Summer Manager, AT&T Research phone: (973) 360-8185

Boost list run by bdawes at, gregod at, cpdaniel at, john at