Boost logo

Boost :

From: Daniel Walker (daniel.j.walker_at_[hidden])
Date: 2006-04-28 19:54:50


On 4/28/06, Matthias Troyer <troyer_at_[hidden]> wrote:
> Hi,
>
> Trying to compile our ALPS project sources (http://alps.comp-
> phys.org) with the CVS HEAD I encountered a number of problems with
> the BGL concept checking. In particular on MacOS X, using the Apple g+
> + 4.0.1, I encounter problems in depth_first_search.hpp with:
>
> template <class Visitor, class Graph>
> class DFSVisitorConcept {
> public:
> void constraints() {
> function_requires< CopyConstructibleConcept<Visitor> >();
> vis.initialize_vertex(u, g);
> vis.start_vertex(u, g);
> vis.discover_vertex(u, g);
> vis.examine_edge(e, g);
> vis.tree_edge(e, g);
> vis.back_edge(e, g);
> vis.forward_or_cross_edge(e, g);
> vis.finish_vertex(u, g);
> }
> private:
> Visitor vis;
> Graph g;
> typename graph_traits<Graph>::vertex_descriptor u;
> typename graph_traits<Graph>::edge_descriptor e;
> };
>
> Somehow this tries to instantiate a default constructor for the
> visitor and the graph. Since some graph types do not have a default
> constructor and no default constructor should actually be required, I
> want to ask whether this is a bug in the compiler or in the concept
> checks?
>
> Matthias

I don't believe models of the Graph or DFSVisitor concepts are
required to be default constructable.

I tried to take a look at this compiling ALPS-1.3a1, but couldn't
reproduce the error with g++ 4.0.3 on Linux. As far as I can tell
neither DFSVisitorConcept nor CopyConstructibleConcept use a default
constructor. However, if for some reason your (custom) visitor class
tries to default construct a graph in a member function
(initialize_vertex(), start_vertex(), etc.) this could cause the
error. Could you give a specific example of code that causes the
error?

Daniel Walker


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