#9403 closed Bugs (fixed)
[ranges] typo in equal_impl causes O(N) impl to be selected instead of O(1) impl
| Reported by: | Eric Niebler | Owned by: | Neil Groves |
|---|---|---|---|
| Milestone: | To Be Determined | Component: | range |
| Version: | Boost Development Trunk | Severity: | Problem |
| Keywords: | Cc: |
Description
The following overload of equal_impl will never be selected because it doesn't take the extra two tag parameters that the others do:
template< class RandomAccessTraversalReadableIterator1,
class RandomAccessTraversalReadableIterator2,
class BinaryPredicate >
inline bool equal_impl( RandomAccessTraversalReadableIterator1 first1,
RandomAccessTraversalReadableIterator1 last1,
RandomAccessTraversalReadableIterator2 first2,
RandomAccessTraversalReadableIterator2 last2,
BinaryPredicate pred )
{
return ((last1 - first1) == (last2 - first2))
&& std::equal(first1, last1, first2, pred);
}
Change History (3)
comment:1 by , 9 years ago
| Status: | new → assigned |
|---|
comment:2 by , 9 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
comment:3 by , 9 years ago
Ha! These errors are hard to spot. The code compiles and yields the correct results, after all. Don't sweat it.
Note:
See TracTickets
for help on using tickets.

Argh, what a school boy error - sorry.