Boost logo

Boost Users :

Subject: Re: [Boost-users] BGL: Vertex or Vertex& ?
From: Andrew Sutton (andrew.n.sutton_at_[hidden])
Date: 2009-01-30 08:00:11


> I've just started using the Boost Graph Library (which is proving to be a
> very nice tool) and I've encountered an issue: When vertex descriptors
> are passed as parameters, stored in vectors, etc., is it better to use
> Vertex&, or is Vertex alone okay. I've been assuming that a vertex
> descriptor is probably a pointer, so I've been using Vertex. But then is
> occurred to me that my assumption could be all wrong and I should be
> using Vertex&. Here are the Graph, Vertex, and Edge definitions I've
> been using:
>

Surprise... it's an integer :) But only if you use vecS to select your
VertexSet. Otherwise, you're right. It's a pointer. Unless it's an edge
descriptor, and then it can be a pair of vertex descriptors (which are int's
or pointers). Unless you're using the PBGL (parallel version) and then I
think they're something different altogether.

However it works, it is convention to pass descriptors by value.

Andrew Sutton
andrew.n.sutton_at_[hidden]



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