[BGL] bfs and boost::ref

At the moment, it's not possible to pass the object returned by boost::ref as visitor to the breadth_first_search function. So, if visitor has state, I need to hold that state by pointer, which is inconvenient. Any opinions on the attached patch? Unless there are any objections, I'll commit it after we branch for release. - Volodya

On Sep 25, 2004, at 8:26 AM, Vladimir Prus wrote:
At the moment, it's not possible to pass the object returned by boost::ref as visitor to the breadth_first_search function. So, if visitor has state, I need to hold that state by pointer, which is inconvenient.
Any opinions on the attached patch? Unless there are any objections, I'll commit it after we branch for release.
Sure, after the branch. Weird name for a type, this 'realBFSVisitor'. You didn't want to use "real_bfs_visitor", or something else more Boost-like? Doug

Doug Gregor wrote:
On Sep 25, 2004, at 8:26 AM, Vladimir Prus wrote:
At the moment, it's not possible to pass the object returned by boost::ref as visitor to the breadth_first_search function. So, if visitor has state, I need to hold that state by pointer, which is inconvenient.
Any opinions on the attached patch? Unless there are any objections, I'll commit it after we branch for release.
Sure, after the branch. Weird name for a type, this 'realBFSVisitor'. You didn't want to use "real_bfs_visitor", or something else more Boost-like?
Well, this seems reasonable name to me, since it's directly derived from BFSVisitor -- the template parameter. With "real_bfs_visitor" the relation is less apparent. Ah, and btw, the patch is incorrect. In 'breadth_first_search', I unwrap the passed reference, and then pass the unwrapped visitor to 'breadth_first_visit', which will copy the visitor, and so on. That's one-character fix, though. - Volodya
participants (2)
-
Doug Gregor
-
Vladimir Prus