bgl question: in which namespace to put the functions
Hello, Developping code so that BGL algorithms can run on the vertices and edges of CGAL triangulations, I am wondering if there are rules or recommendations for in which namespace the functions source, target, vertices, out_edges ... shall go. In boost, because it is boostish code, or in CGAL, because that is the namespace where the triangulation lives in? thank's in advance, andreas
Hi Andreas, You can put the functions in CGAL, and they will be found via C++'s rules for argument dependent lookup. Cheers, Jeremy P.S. There's been lots of debates about this, but back when we were designing the BGL, this is what we decided on. On Apr 28, 2005, at 3:01 PM, Andreas Fabri wrote:
Hello,
Developping code so that BGL algorithms can run on the vertices and edges of CGAL triangulations, I am wondering if there are rules or recommendations for in which namespace the functions source, target, vertices, out_edges ... shall go.
In boost, because it is boostish code, or in CGAL, because that is the namespace where the triangulation lives in?
thank's in advance,
andreas _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________
Jeremy Siek
On Thursday 28 April 2005 20:01, Andreas Fabri wrote:
Hello,
Developping code so that BGL algorithms can run on the vertices and edges of CGAL triangulations, I am wondering if there are rules or recommendations for in which namespace the functions source, target, vertices, out_edges ... shall go.
In boost, because it is boostish code, or in CGAL, because that is the namespace where the triangulation lives in?
I did something a bit similar last year (writting a wrapper to be able to apply BGL's algorithms to the OpenMesh library). I put all the vertices, edges, etc. classes and functions in boost namespace. As far as I understand, that shouldn't cause too much problems, since all the types and functions I added in there were template specializations. That looked like : // The graph traits struct graph_traits<MyMesh> { typedef MyMesh::FaceHandle vertex_descriptor; typedef MyMesh::EdgeHandle edge_descriptor; typedef IteratorWrapperMyMesh::ConstFaceFaceIter adjacency_iterator; typedef CircularIteratorWrapper out_edge_iterator; // [...] etc }; // Some functions specialization graph_traits<MyMesh>::vertex_descriptor target(graph_traits<MyMesh>::edge_descriptor e, const MyMesh& g) { ... } etc. Cheers
Well, the graph_traits specialization has to live in boost, but the functions such as target can go in your own namespace, the same namespace as your graph and edge type. On Apr 28, 2005, at 7:12 PM, Cyrille.Damez@laposte.net wrote:
On Thursday 28 April 2005 20:01, Andreas Fabri wrote:
Hello,
Developping code so that BGL algorithms can run on the vertices and edges of CGAL triangulations, I am wondering if there are rules or recommendations for in which namespace the functions source, target, vertices, out_edges ... shall go.
In boost, because it is boostish code, or in CGAL, because that is the namespace where the triangulation lives in?
I did something a bit similar last year (writting a wrapper to be able to apply BGL's algorithms to the OpenMesh library). I put all the vertices, edges, etc. classes and functions in boost namespace. As far as I understand, that shouldn't cause too much problems, since all the types and functions I added in there were template specializations. That looked like :
// The graph traits struct graph_traits<MyMesh> { typedef MyMesh::FaceHandle vertex_descriptor; typedef MyMesh::EdgeHandle edge_descriptor; typedef IteratorWrapperMyMesh::ConstFaceFaceIter adjacency_iterator; typedef CircularIteratorWrapper out_edge_iterator; // [...] etc };
// Some functions specialization graph_traits<MyMesh>::vertex_descriptor target(graph_traits<MyMesh>::edge_descriptor e, const MyMesh& g) { ... }
etc.
Cheers _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________
Jeremy Siek
participants (3)
-
Andreas Fabri
-
Cyrille.Damez@laposte.net
-
Jeremy Siek