Opened 13 years ago
Closed 12 years ago
#4131 closed Bugs (fixed)
Including boost/range/numeric.hpp causes compile errors without defining NDEBUG
| Reported by: | Owned by: | Neil Groves | |
|---|---|---|---|
| Milestone: | Boost 1.43.0 | Component: | range | 
| Version: | Boost Development Trunk | Severity: | Problem | 
| Keywords: | Cc: | 
Description
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
  Note:
 See   TracTickets
 for help on using tickets.
    
