Re: [Boost-bugs] [Boost C++ Libraries] #2119: graph/depth_first_search.hpp needs graph/vector_as_graph.hpp

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #2119: graph/depth_first_search.hpp needs graph/vector_as_graph.hpp
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2008-07-17 18:18:53


#2119: graph/depth_first_search.hpp needs graph/vector_as_graph.hpp
--------------------------------+-------------------------------------------
  Reporter: axel_at_[hidden] | Owner: dgregor
      Type: Patches | Status: closed
 Milestone: Boost 1.36.0 | Component: graph
   Version: Boost 1.35.0 | Severity: Problem
Resolution: worksforme | Keywords:
--------------------------------+-------------------------------------------

Comment(by dgregor):

 Unfortunately, it seems that vector_as_graph.hpp must always be included
 before any of the graph algorithms it will be used in, and we actually
 can't fix this problem. The issue is that a call "vertices(g)" inside a
 BGL algorithm (where "vertices" is a dependent name because "g" is of type
 Graph, a template type parameter) will only find functions named
 "vertices" in namespace boost that have been declared before the BGL
 algorithm itself (at template definition time) and, then, any functions
 found through ADL at instantiation time.

 The problem, for vector_as_graph.hpp, is that we define the vertices()
 function for vectors in namespace boost, so it won't be found by ADL.
 Thus, vector_as_graph.hpp only works properly if it is included prior to
 the BGL algorithm that will use it. This problem is compounded by non-
 conforming compilers that perform full name lookup for "vertices" again at
 instantiation time (GCC <= 4.0.1 seems to do this, GCC >= 4.3.0 does not).

 The fix would be to put the vertices() function into namespace "std", but
 we aren't allowed to do that. So, we're stuck with the workaround of
 including vector_as_graph.hpp early enough to make sure this failure
 doesn't happen.

-- 
Ticket URL: <http://svn.boost.org/trac/boost/ticket/2119#comment:3>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:58 UTC