[Boost-bugs] [Boost C++ Libraries] #9524: assertions in range-based inner_product will change behavior

Subject: [Boost-bugs] [Boost C++ Libraries] #9524: assertions in range-based inner_product will change behavior
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-12-25 04:20:29


#9524: assertions in range-based inner_product will change behavior
------------------------------+------------------------
 Reporter: eric_niebler | Owner: neilgroves
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: range
  Version: Boost 1.54.0 | Severity: Problem
 Keywords: |
------------------------------+------------------------
 In range/numeric.hpp, in `inner_product`, I see the following assertion:

 {{{
 BOOST_ASSERT( boost::distance(rng2) >= boost::distance(rng1) );
 }}}

 A good idea in theory. But `rng2` and `rng1` can be input ranges. Simply
 computing the distance will consume the input that the algorithms needs.

 Drop the assertions.

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