Opened 9 years ago
Closed 9 years ago
#9524 closed Bugs (fixed)
assertions in range-based inner_product will change behavior
| Reported by: | Eric Niebler | Owned by: | Neil Groves |
|---|---|---|---|
| Milestone: | To Be Determined | Component: | range |
| Version: | Boost 1.54.0 | Severity: | Problem |
| Keywords: | Cc: |
Description
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.
Change History (3)
comment:1 by , 9 years ago
| Status: | new → assigned |
|---|
comment:2 by , 9 years ago
comment:3 by , 9 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.

I'll drop the assertions for the case where the traversal is < bidirectional.