Boost logo

Boost Users :

Subject: Re: [Boost-users] [boost-users][graph] There is graph::null_vertex, but no "null_edge"!
From: al.zatv (al.zatv_at_[hidden])
Date: 2011-02-17 18:00:00


Jeremiah Willcock <jewillco_at_[hidden]> писал(а) в своём письме Fri, 18
Feb 2011 01:47:39 +0300:
>> There is graph::null_vertex, but no "null_edge".

> It looks like you are correct. The BGL functions that can return
> non-existent edges return iterators instead, in which case
> edges(g).end() is a legitimate "null" return value. If you know the
> graph is non-empty, you can also return std::pair<edge_descriptor,
> bool>, returning make_pair(*edges(g).first, false) for the "not found"
> case and make_pair(..., true) otherwise.

Thank you for answer! I did it this way (for not founded edge)
    return make_pair( false, Graph::edge_descriptor() );

Am I correct?

But, I think, it will be much better if null_edge will be added to the
library. It can be -1 for vector containers and null for pointer-based
descriptors, etc.


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