Boost logo

Boost :

Subject: [boost] Boost Graph Library: why are `source()`/`target()` non-member functions?
From: Max Moroz (maxmoroz_at_[hidden])
Date: 2013-04-19 22:16:17


Why is `source()` not a member function of the graph class?

(See http://www.boost.org/doc/libs/1_53_0/libs/graph/doc/index.html for
description, and boost/graph/adjacency_list.hpp and
boost/graph/adjacency_matrix.hpp for implementation.)

I thought the reason was that it was a generic algorithm. But it's not.
There's no interface (beyond `source()` itself) exposed by an edge
descriptor that would allow `source()` to avoid digging into the
implementation.

If I interpret the code correctly, `source()` reads directly from the
internal data structure of the edge descriptor
(`detail::edge_base.m_source`), which I am pretty sure is the
implementation detail (`m_source`, despite being strangely exposed as a
public member, is not the standard interface; otherwise it would have been
defined as such, and `source()` would have been entirely redundant.)

I think I'm missing something, but what?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk