[Boost-bugs] [Boost C++ Libraries] #4642: Including some BGL header files and boost/range/irange.hpp causes compile errors due to the name conflict

Subject: [Boost-bugs] [Boost C++ Libraries] #4642: Including some BGL header files and boost/range/irange.hpp causes compile errors due to the name conflict
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-09-10 12:44:42


#4642: Including some BGL header files and boost/range/irange.hpp causes compile
errors due to the name conflict
-------------------------------------------------------+--------------------
 Reporter: Naoki Yoshioka <yoshioka.naoki@…> | Owner: asutton
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: graph
  Version: Boost 1.44.0 | Severity: Problem
 Keywords: |
-------------------------------------------------------+--------------------
 Some BGL headers like boost/graph/detail/adjacency_list.hpp include
 boost/pending/integer_range.hpp and use a class template
 boost::integer_range to represent a vertex/edge list.
 Since 1.44.0, however, Boost.Range supports a class template which has the
 same name and probably the same role in boost/range/irange.hpp; it didn't
 have integer_range and instead used
 boost::iterator_range<boost::range_detail::integer_iterator<Integer> > in
 1.43.0.
 Therefore the following simple code causes compile errors using 1.44.0.

 {{{
 // test.cpp
 #include <boost/graph/adjacency_list.hpp>
 #include <boost/range/irange.hpp>

 int main() { return 0; }
 }}}

 The errors are as follows;

 {{{
 $ g++ --version
 g++ (Ubuntu 4.4.3-4ubuntu5) 4.4.3
 Copyright (C) 2009 Free Software Foundation, Inc.
 This is free software; see the source for copying conditions. There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
 PURPOSE.

 $ g++ test.cpp -I/usr/local/include/boost_1_44_0
 In file included from test.cpp:2:
 /usr/local/include/boost_1_44_0/boost/range/irange.hpp:176: error:
 redefinition of ‘class boost::integer_range<IntegerType>’
 /usr/local/include/boost_1_44_0/boost/pending/integer_range.hpp:23: error:
 previous definition of ‘class boost::integer_range<IntegerType>’
 $ g++ test.cpp -I/usr/local/include/boost_1_43_0
 $
 }}}

 Note that /usr/local/include/boost_1_xx_x is the directory the boost
 1.xx.x is installed.

 To fix this problem, I think it's OK just to replace the including file
 from boost/pending/integer_range.hpp to boost/range/irange.hpp in BGL.
 The header files which include boost/pending/integer_range.hpp are as
 follows;

 * boost/graph/adjacency_matrix.hpp
 * boost/graph/detail/adjacency_list.hpp
 * boost/graph/edge_list.hpp
 * boost/graph/vector_as_graph.hpp

 Note that I haven't checked whether this modification works completely
 well or not.
 I've just checked the above example code works after this modification.

 After this modification, I think boost/pending/integer_range.hpp can be
 removed from the boost library because no other files include this pending
 header file.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4642>
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:50:04 UTC