Boost logo

Boost :

From: Gary Powell (Gary.Powell_at_[hidden])
Date: 2000-08-30 10:58:42

> Gary Powell writes:
> > Also what is the point of returning a pair<TYPE,bool> when the bool is
> > always "true"? (dynamic_graph.cct)
> The MutableGraph concept defines the return type for add_edge() to be
> pair<edge_descriptor,bool>. When the graph disallows parallel edges,
> the bool is important, otherwise it will always be true. I suppose
> I could have split the interface:
> MutableGraph
> pair<edge_descriptor,bool> add_edge(...)
> MutableMultiGraph
> edge_descriptor add_edge(...)
> But I didn't think it was worth the effort, and could get in the way
> of some generic algorithms. Perhaps this was the wrong choice? The
> standard went with different interfaces for set/multiset but I always
> thought that was annoying.
Well, in no place in GGCL (examples included) does anything use the result
of add_edge. There is one place where the result is printed to std::cout.
So the question could be, is it worth the effort of MutableGraph to even
bother reporting the failure? Ok, So that's a rhetorical question, and I'm
as guilty as most programmers in ignoring the result of functions. I
suppose if it really matters, I'd check, i.e. heart monitor code, airplane
control code. But since you don't appear to need this result I'd change the
return type.

  I could be swayed by a generic algorithm that actually used it.



  Jens's the VTL library uses template templates. It's more a handy way of
hiding implementation details than required.

Boost list run by bdawes at, gregod at, cpdaniel at, john at