Graph library concept check problem

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

On 4/28/06, Matthias Troyer <troyer@itp.phys.ethz.ch> 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

On Apr 28, 2006, at 4:54 PM, Daniel Walker wrote:
On 4/28/06, Matthias Troyer <troyer@itp.phys.ethz.ch> 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:
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?
I saw the same problem also in other libraries now and it seems to be an issue with concept checking in general on my machine. The default constructors of all data members of the concept checking classes seem to get instantiated somehow. I'll try to track this down. Matthias

Matthias Troyer <troyer@itp.phys.ethz.ch> writes:
On Apr 28, 2006, at 4:54 PM, Daniel Walker wrote:
On 4/28/06, Matthias Troyer <troyer@itp.phys.ethz.ch> 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:
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?
I saw the same problem also in other libraries now and it seems to be an issue with concept checking in general on my machine. The default constructors of all data members of the concept checking classes seem to get instantiated somehow. I'll try to track this down.
I've been working on the concept checking library and may have caused some churn on the CVS head. Sorry about that. -- Dave Abrahams Boost Consulting www.boost-consulting.com

On May 2, 2006, at 5:21 AM, David Abrahams wrote:
Matthias Troyer <troyer@itp.phys.ethz.ch> writes:
I saw the same problem also in other libraries now and it seems to be an issue with concept checking in general on my machine. The default constructors of all data members of the concept checking classes seem to get instantiated somehow. I'll try to track this down.
I've been working on the concept checking library and may have caused some churn on the CVS head. Sorry about that.
Hi Dave, That must have been it. Thanks for fixing the problem Matthias
participants (3)
-
Daniel Walker
-
David Abrahams
-
Matthias Troyer