Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r81099 - trunk/boost/graph
From: jewillco_at_[hidden]
Date: 2012-10-29 14:16:23


Author: jewillco
Date: 2012-10-29 14:16:22 EDT (Mon, 29 Oct 2012)
New Revision: 81099
URL: http://svn.boost.org/trac/boost/changeset/81099

Log:
Applied patch from #7600; fixes #7600
Text files modified:
   trunk/boost/graph/named_graph.hpp | 13 +++++++++++--
   1 files changed, 11 insertions(+), 2 deletions(-)

Modified: trunk/boost/graph/named_graph.hpp
==============================================================================
--- trunk/boost/graph/named_graph.hpp (original)
+++ trunk/boost/graph/named_graph.hpp 2012-10-29 14:16:22 EDT (Mon, 29 Oct 2012)
@@ -11,6 +11,7 @@
 #define BOOST_GRAPH_NAMED_GRAPH_HPP
 
 #include <boost/config.hpp>
+#include <boost/type_traits/is_same.hpp>
 #include <boost/type_traits/remove_cv.hpp>
 #include <boost/type_traits/remove_reference.hpp>
 #include <boost/multi_index_container.hpp>
@@ -18,6 +19,7 @@
 #include <boost/multi_index/member.hpp>
 #include <boost/optional.hpp>
 #include <boost/throw_exception.hpp>
+#include <boost/utility/enable_if.hpp>
 #include <stdexcept> // for std::runtime_error
 
 namespace boost { namespace graph {
@@ -352,8 +354,15 @@
 
 /// Retrieve the vertex associated with the given name, or add a new
 /// vertex with that name if no such vertex is available.
-template<BGL_NAMED_GRAPH_PARAMS>
-Vertex
+/// Note: This is enabled only when the vertex property type is different
+/// from the vertex name to avoid ambiguous overload problems with
+/// the add_vertex() function that takes a vertex property.
+template<BGL_NAMED_GRAPH_PARAMS>
+ typename disable_if<is_same<
+ typename BGL_NAMED_GRAPH::vertex_name_type,
+ VertexProperty
+ >,
+Vertex>::type
 add_vertex(typename BGL_NAMED_GRAPH::vertex_name_type const& name,
            BGL_NAMED_GRAPH& g)
 {


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