
On Thu, 7 Mar 2013, Takatoshi Kondo wrote:
Hi Jeremiah,
Thank you for your reply. I'm relieved that I understand correctly. I come up with a related question. I think that general graph algorithm developers should test two different things.
One is concepts. If function my_algo() required VertexAndEdgeListGraphConcept for the parameter g, it should be checked as follows:
#include
template <typename Graph> void my_algo(Graph g) { BOOST_CONCEPT_ASSERT(( boost::VertexAndEdgeListGraphConcept<Graph> ));
boost::edge(0, 1, g); // accidental invalid use ... Line A }
But this test cannot detect out of concepts functions usage as Line A if class Graph accidentally provide them. So, these problems should be detected the following test:
void my_algo_test() { typedef /* Only satisfies VertexAndListGraphConcept*/ Graph; // ... Line B Graph g; my_algo(g); }
How do I define the type that is only satisfied specific concepts?
Those are called "archetypes" in the terminology of the Boost Concept
Check Library
(http://www.boost.org/doc/libs/1_53_0/libs/concept_check/concept_check.htm).
There is a set of them for Boost.Graph concepts in