Boost logo

Boost Users :

Subject: Re: [Boost-users] [BGL / General] member of struct is a reference - why?
From: Agustín K-ballo Bergé (kaballo86_at_[hidden])
Date: 2012-01-10 14:48:01


On 10/01/2012 16:35, Max Limper wrote:
> Hi everybody,
> I was just going through the "File Dependency" example for the graph
> library and found this piece of code which is a very simple cycle
> detector:
>
>
> struct cycle_detector : public dfs_visitor<>
>
>
> I guess there must be a reason why the person that made the example
> chose to use a reference, and it only works that way... any ideas why?
>

Probably because visitors get copied around, thus if not for the
reference you would be making modifications to a temporal copy of it.

Agustín K-ballo Bergé.-
http://talesofcpp.blogspot.com


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