Boost logo

Boost Users :

Subject: Re: [Boost-users] boost graph library, default_dfs_visitor, dfs
From: Suresh Kumar (suresh.amritapuri_at_[hidden])
Date: 2009-12-16 14:56:12


I understood, thanks Andrew Sutton,
suresh

On Wed, Dec 16, 2009 at 5:52 AM, Andrew Sutton
<andrew.n.sutton_at_[hidden]> wrote:
>
>> > My problem: size of the finishingOrder vector is zero outside the
>> > my_visitor::finish_vertex method. I checked its size inside the
>> > my_visitor::finish_vertex method and its value is increasing...
>>
>> All visitors have to be copy constructible and depth_first_search will
>> operate on the copied object.
>
>
> Actually, it's the fact that the visitor is copied that's causing the
> problem. The visitor needs to declare
> it's vector member as a reference (to a vector declared somewhere else). For
> example:
>
> struct my_visitor : default_dfs_visitor {
>   my_visitor(vector<Vertex>& order)
>     : finishingOrder(order)
>   { }
>   vector<Vertex>& finishingOrder;
> };
>
> Andrew Sutton
> andrew.n.sutton_at_[hidden]
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>

-- 
R. Suresh Kumar
PhD Student, Vislab
#216, Engineering II Bldg
University of California, Riverside,
CA 92521

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