|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r80505 - in trunk/boost: graph pending
From: jewillco_at_[hidden]
Date: 2012-09-12 08:24:05
Author: jewillco
Date: 2012-09-12 08:24:04 EDT (Wed, 12 Sep 2012)
New Revision: 80505
URL: http://svn.boost.org/trac/boost/changeset/80505
Log:
Allowed pointers-to-base-members to be used to access properties of derived bundled property classes; fixes #7308
Text files modified:
trunk/boost/graph/properties.hpp | 8 ++++----
trunk/boost/pending/property.hpp | 11 ++++++-----
2 files changed, 10 insertions(+), 9 deletions(-)
Modified: trunk/boost/graph/properties.hpp
==============================================================================
--- trunk/boost/graph/properties.hpp (original)
+++ trunk/boost/graph/properties.hpp 2012-09-12 08:24:04 EDT (Wed, 12 Sep 2012)
@@ -21,7 +21,7 @@
#include <boost/graph/property_maps/null_property_map.hpp>
#include <boost/graph/graph_traits.hpp>
-#include <boost/type_traits/is_convertible.hpp>
+#include <boost/type_traits.hpp>
#include <boost/limits.hpp>
#include <boost/mpl/and.hpp>
#include <boost/mpl/not.hpp>
@@ -149,13 +149,13 @@
template <typename G, typename R, typename T>
struct property_kind_from_graph<G, R T::*> {
typedef typename boost::mpl::if_<
- boost::is_same<T, typename vertex_bundle_type<G>::type>,
+ boost::is_base_of<T, typename vertex_bundle_type<G>::type>,
vertex_property_tag,
typename boost::mpl::if_<
- boost::is_same<T, typename edge_bundle_type<G>::type>,
+ boost::is_base_of<T, typename edge_bundle_type<G>::type>,
edge_property_tag,
typename boost::mpl::if_<
- boost::is_same<T, typename graph_bundle_type<G>::type>,
+ boost::is_base_of<T, typename graph_bundle_type<G>::type>,
graph_property_tag,
void>::type>::type>::type type;
};
Modified: trunk/boost/pending/property.hpp
==============================================================================
--- trunk/boost/pending/property.hpp (original)
+++ trunk/boost/pending/property.hpp 2012-09-12 08:24:04 EDT (Wed, 12 Sep 2012)
@@ -11,6 +11,7 @@
#include <boost/mpl/has_xxx.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/type_traits.hpp>
+#include <boost/static_assert.hpp>
namespace boost {
@@ -53,7 +54,7 @@
enum graph_bundle_t {graph_bundle};
// Code to look up one property in a property list:
- template <typename PList, typename PropName>
+ template <typename PList, typename PropName, typename Enable = void>
struct lookup_one_property_internal {BOOST_STATIC_CONSTANT(bool, found = false);};
// Special-case properties (vertex_all, edge_all, graph_all)
@@ -135,12 +136,12 @@
// Pointer-to-member access to bundled properties
#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES
- template <typename T, typename R>
- struct lookup_one_property_internal<T, R T::*> {
+ template <typename T, typename TMaybeBase, typename R>
+ struct lookup_one_property_internal<T, R TMaybeBase::*, typename enable_if<is_base_of<TMaybeBase, T> >::type> {
BOOST_STATIC_CONSTANT(bool, found = true);
typedef R type;
- static R& lookup(T& x, R T::*ptr) {return x.*ptr;}
- static const R& lookup(const T& x, R T::*ptr) {return x.*ptr;}
+ static R& lookup(T& x, R TMaybeBase::*ptr) {return x.*ptr;}
+ static const R& lookup(const T& x, R TMaybeBase::*ptr) {return x.*ptr;}
};
#endif
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