Boost logo

Boost Users :

Subject: Re: [Boost-users] [BGL] Out-of-range Edge Endpoints
From: Hossein Haeri (powerprogman_at_[hidden])
Date: 2010-04-29 20:25:02


Dear Andrew,

> > > What I can't see is what will happen when the endpoints don't fall in
> > > [0, n). Is that documented somewhere?
> > >
> >
> > I don't think so.  It's basically undefined behavior -- it usually ends
> > up in an out-of-bounds array access and thus likely a crash.
>
> In the case of the constructor, it may.

And, my question was exactly about the ctor. I'm surprised to see there is no exact behviour specification for this. Shouldn't it be done sometime?

> In the case of add_edge (with the vertex list == vecS), adjacency_list
> will automatically resize -- I think I remember being surprised with
> this before :)

The documentation says: "If the VertexList selector is vecS, and if either vertex descriptor u or v (which are integers) has a value greater than the current number of vertices in the graph, the graph is enlarged so that the number of vertices is std::max(u,v) + 1."

Cheers,
--Hossein


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