[Boost-bugs] [Boost C++ Libraries] #4131: Including boost/range/numeric.hpp causes compile errors without defining NDEBUG

Subject: [Boost-bugs] [Boost C++ Libraries] #4131: Including boost/range/numeric.hpp causes compile errors without defining NDEBUG
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-04-21 10:03:20


#4131: Including boost/range/numeric.hpp causes compile errors without defining
NDEBUG
-------------------------------------------------------+--------------------
 Reporter: Naoki Yoshioka <yoshioka.naoki@…> | Owner: neilgroves
     Type: Bugs | Status: new
Milestone: Boost 1.43.0 | Component: range
  Version: Boost Development Trunk | Severity: Problem
 Keywords: |
-------------------------------------------------------+--------------------
 Although boost::inner_product in boost/range/numeric.hpp calls a function
 template boost::distance for static asserting, the header file has no
 statement to include boost/range/distance.hpp. Therefore, for example, the
 following code cannot be compiled without -DNDEBUG option.

 {{{
 // test.cpp
 #include <boost/range/numeric.hpp>

 int main()
 {
   int array[3] = {0, 1, 2};
   boost::accumulate(array, 0);

   return 0;
 }
 }}}

 The errors are as follows;

 {{{
 $ g++ --version
 g++ (GCC) 4.2.4 (Ubuntu 4.2.4-1ubuntu4)
 Copyright (C) 2007 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
 In file included from test.cpp:1:
 include/boost/range/numeric.hpp: In function ‘Value
 boost::inner_product(const
 SinglePassRange1&, const SinglePassRange2&, Value)’:
 include/boost/range/numeric.hpp:59: error: ‘distance’ is not a member of
 â€˜boost’
 include/boost/range/numeric.hpp:59: error: ‘distance’ is not a member of
 â€˜boost’
 include/boost/range/numeric.hpp: In function ‘Value
 boost::inner_product(const
 SinglePassRange1&, const SinglePassRange2&, Value, BinaryOperation1,
 BinaryOperat
 ion2)’:
 include/boost/range/numeric.hpp:74: error: ‘distance’ is not a member of
 â€˜boost’
 include/boost/range/numeric.hpp:74: error: ‘distance’ is not a member of
 â€˜boost’
 $ g++ test.cpp -DNDEBUG
 }}}

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