On Sun, 13 Jun 2010, Eric Fowler wrote:
On Fri, Jun 11, 2010 at 12:29 PM, Jeremiah Willcock <jewillco@osl.iu.edu> wrote: On Thu, 10 Jun 2010, Eric Fowler wrote:
It seems I do not have a mutable graph. This sort of raises another issue: how do I declare an object that is described by a concept?
The best you can do is apply a concept checking class. That doesn't filter the members so you can only use the MutableGraph-required functions, but it at least makes sure that the graph you have is a MutableGraph.
For example, in this case I know I need a MutableGraph, and I see from the doc (http://www.boost.org/doc/libs/1_43_0/libs/graph/doc/MutableGraph.html) that MutableGraphs have certain properties, such as DefaultConstructible, etc.
Now, how do I declare a MutableGraph, and know I have one? I know that:
typedef adjacency_list<vecS, vecS, undirectedS, POS<position_type> LEN<position_type> > DG;
What methods are missing? Could you please try applying the MutableGraph concept checking class to the DG type and see what breaks?
Again I must ask: How? I have mined the examples and come up with: BOOST_CONCEPT_ASSERT((MutableGraph<DG>)); and BOOST_CONCEPT_ASSERT((MutableGraph<DG<int>)); BOOST_CONCEPT_ASSERT((BidirectionalGraph<DG<int>));
and put them the head of a .cpp file that uses DG. These have generated obscure and unhelpful error messages.
The first line is the one that's correct; what errors does that produce? The other two CONCEPT_ASSERT lines you put are not syntactically correct.
Copying this line from the examples and using it in the same place produces no errors:
BOOST_CONCEPT_ASSERT((BidirectionalIterator<std::list<int>::iterator>));
What do you mean? You want to add methods/functions to the graph type to make it model a specific concept?
No. I mean, yes. I want to know how to define my graph type so it models a specific concept.
You'd need to look at the documentation and then write the appropriate functions. Beyond that, the concept checking classes are currently the only compiler-based help you get without actual concepts in C++. -- Jeremiah Willcock