|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r81589 - trunk/boost/graph
From: jewillco_at_[hidden]
Date: 2012-11-27 10:14:37
Author: jewillco
Date: 2012-11-27 10:14:36 EST (Tue, 27 Nov 2012)
New Revision: 81589
URL: http://svn.boost.org/trac/boost/changeset/81589
Log:
Removed references to member types not required by documentation; fixed concept definitions; fixes #7741
Text files modified:
trunk/boost/graph/graph_concepts.hpp | 30 ++++++++++++++++++++--------
trunk/boost/graph/graph_traits.hpp | 41 ++++++++++++++++++++++++++++++++-------
2 files changed, 54 insertions(+), 17 deletions(-)
Modified: trunk/boost/graph/graph_concepts.hpp
==============================================================================
--- trunk/boost/graph/graph_concepts.hpp (original)
+++ trunk/boost/graph/graph_concepts.hpp 2012-11-27 10:14:36 EST (Tue, 27 Nov 2012)
@@ -20,6 +20,9 @@
#include <boost/graph/numeric_values.hpp>
#include <boost/graph/buffer_concepts.hpp>
#include <boost/concept_check.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/mpl/not.hpp>
+#include <boost/static_assert.hpp>
#include <boost/detail/workaround.hpp>
#include <boost/concept/assert.hpp>
@@ -55,12 +58,10 @@
BOOST_concept(Graph,(G))
{
typedef typename graph_traits<G>::vertex_descriptor vertex_descriptor;
+ typedef typename graph_traits<G>::edge_descriptor edge_descriptor;
typedef typename graph_traits<G>::directed_category directed_category;
- typedef typename graph_traits<G>::edge_parallel_category
- edge_parallel_category;
-
- typedef typename graph_traits<G>::traversal_category
- traversal_category;
+ typedef typename graph_traits<G>::edge_parallel_category edge_parallel_category;
+ typedef typename graph_traits<G>::traversal_category traversal_category;
BOOST_CONCEPT_USAGE(Graph)
{
@@ -75,11 +76,12 @@
: Graph<G>
{
typedef typename graph_traits<G>::edge_descriptor edge_descriptor;
- typedef typename graph_traits<G>::out_edge_iterator
- out_edge_iterator;
+ typedef typename graph_traits<G>::out_edge_iterator out_edge_iterator;
+ typedef typename graph_traits<G>::degree_size_type degree_size_type;
+ typedef typename graph_traits<G>::traversal_category traversal_category;
- typedef typename graph_traits<G>::traversal_category
- traversal_category;
+ BOOST_STATIC_ASSERT((boost::mpl::not_<boost::is_same<out_edge_iterator, void> >::value));
+ BOOST_STATIC_ASSERT((boost::mpl::not_<boost::is_same<degree_size_type, void> >::value));
BOOST_CONCEPT_USAGE(IncidenceGraph) {
BOOST_CONCEPT_ASSERT((MultiPassInputIterator<out_edge_iterator>));
@@ -123,6 +125,8 @@
BOOST_CONCEPT_ASSERT((Convertible<traversal_category,
bidirectional_graph_tag>));
+ BOOST_STATIC_ASSERT((boost::mpl::not_<boost::is_same<in_edge_iterator, void> >::value));
+
p = in_edges(v, g);
n = in_degree(v, g);
e = *p.first;
@@ -153,6 +157,8 @@
BOOST_CONCEPT_ASSERT((Convertible<traversal_category,
adjacency_graph_tag>));
+ BOOST_STATIC_ASSERT((boost::mpl::not_<boost::is_same<adjacency_iterator, void> >::value));
+
p = adjacent_vertices(v, g);
v = *p.first;
const_constraints(g);
@@ -178,6 +184,9 @@
BOOST_CONCEPT_ASSERT((Convertible<traversal_category,
vertex_list_graph_tag>));
+ BOOST_STATIC_ASSERT((boost::mpl::not_<boost::is_same<vertex_iterator, void> >::value));
+ BOOST_STATIC_ASSERT((boost::mpl::not_<boost::is_same<vertices_size_type, void> >::value));
+
#ifdef BOOST_VECTOR_AS_GRAPH_GRAPH_ADL_HACK
// dwa 2003/7/11 -- This clearly shouldn't be necessary, but if
// you want to use vector_as_graph, it is! I'm sure the graph
@@ -227,6 +236,9 @@
BOOST_CONCEPT_ASSERT((Convertible<traversal_category,
edge_list_graph_tag>));
+ BOOST_STATIC_ASSERT((boost::mpl::not_<boost::is_same<edge_iterator, void> >::value));
+ BOOST_STATIC_ASSERT((boost::mpl::not_<boost::is_same<edges_size_type, void> >::value));
+
p = edges(g);
e = *p.first;
u = source(e, g);
Modified: trunk/boost/graph/graph_traits.hpp
==============================================================================
--- trunk/boost/graph/graph_traits.hpp (original)
+++ trunk/boost/graph/graph_traits.hpp 2012-11-27 10:14:36 EST (Tue, 27 Nov 2012)
@@ -20,6 +20,7 @@
#include <boost/mpl/not.hpp>
#include <boost/mpl/has_xxx.hpp>
#include <boost/mpl/void.hpp>
+#include <boost/mpl/identity.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/iterator/iterator_categories.hpp>
#include <boost/iterator/iterator_adaptor.hpp>
@@ -28,23 +29,47 @@
namespace boost {
+ namespace detail {
+#define BOOST_GRAPH_MEMBER_OR_VOID(name) \
+ BOOST_MPL_HAS_XXX_TRAIT_DEF(name) \
+ template <typename T> struct BOOST_JOIN(get_member_, name) {typedef typename T::name type;}; \
+ template <typename T> struct BOOST_JOIN(get_opt_member_, name): \
+ boost::mpl::eval_if_c< \
+ BOOST_JOIN(has_, name)<T>::value, \
+ BOOST_JOIN(get_member_, name)<T>, \
+ boost::mpl::identity<void> > \
+ {};
+ BOOST_GRAPH_MEMBER_OR_VOID(adjacency_iterator)
+ BOOST_GRAPH_MEMBER_OR_VOID(out_edge_iterator)
+ BOOST_GRAPH_MEMBER_OR_VOID(in_edge_iterator)
+ BOOST_GRAPH_MEMBER_OR_VOID(vertex_iterator)
+ BOOST_GRAPH_MEMBER_OR_VOID(edge_iterator)
+ BOOST_GRAPH_MEMBER_OR_VOID(vertices_size_type)
+ BOOST_GRAPH_MEMBER_OR_VOID(edges_size_type)
+ BOOST_GRAPH_MEMBER_OR_VOID(degree_size_type)
+ }
+
template <typename G>
struct graph_traits {
+#define BOOST_GRAPH_PULL_OPT_MEMBER(name) \
+ typedef typename detail::BOOST_JOIN(get_opt_member_, name)<G>::type name;
+
typedef typename G::vertex_descriptor vertex_descriptor;
typedef typename G::edge_descriptor edge_descriptor;
- typedef typename G::adjacency_iterator adjacency_iterator;
- typedef typename G::out_edge_iterator out_edge_iterator;
- typedef typename G::in_edge_iterator in_edge_iterator;
- typedef typename G::vertex_iterator vertex_iterator;
- typedef typename G::edge_iterator edge_iterator;
+ BOOST_GRAPH_PULL_OPT_MEMBER(adjacency_iterator)
+ BOOST_GRAPH_PULL_OPT_MEMBER(out_edge_iterator)
+ BOOST_GRAPH_PULL_OPT_MEMBER(in_edge_iterator)
+ BOOST_GRAPH_PULL_OPT_MEMBER(vertex_iterator)
+ BOOST_GRAPH_PULL_OPT_MEMBER(edge_iterator)
typedef typename G::directed_category directed_category;
typedef typename G::edge_parallel_category edge_parallel_category;
typedef typename G::traversal_category traversal_category;
- typedef typename G::vertices_size_type vertices_size_type;
- typedef typename G::edges_size_type edges_size_type;
- typedef typename G::degree_size_type degree_size_type;
+ BOOST_GRAPH_PULL_OPT_MEMBER(vertices_size_type)
+ BOOST_GRAPH_PULL_OPT_MEMBER(edges_size_type)
+ BOOST_GRAPH_PULL_OPT_MEMBER(degree_size_type)
+#undef BOOST_GRAPH_PULL_OPT_MEMBER
static inline vertex_descriptor null_vertex();
};
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk