Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#12552 closed Bugs (wontfix)

Change of the interface of Searching Algorithms breaks client code

Reported by: tusk.kun@… Owned by: Marshall Clow
Milestone: To Be Determined Component: algorithm
Version: Boost 1.62.0 Severity: Showstopper
Keywords: Cc: tusk.kun@…

Description

I am using Boyer-Moore Search from the Algorithm component. The change of search functions interface introduced by this commit https://github.com/boostorg/algorithm/commit/205f5ff4bbb00ece289892089a6c94c975e97ca2 broke my code. Because now search functions return pair of iterators instead of one iterator. Documentations does not reflect these chenges: http://www.boost.org/doc/libs/1_62_0/libs/algorithm/doc/html/algorithm/Searching.html#the_boost_algorithm_library.Searching.BoyerMoore

Please explain why are you making changes which are not backward compatible and break users code?

Change History (2)

comment:1 by Marshall Clow, 6 years ago

Resolution: wontfix
Status: newclosed

First, I apologize for the lack of documentation of the changes. That has been corrected, and will appear in the 1.63.0 release, along with some porting notes. You can see those docs in the develop branch now.

As for "why did I make this change", it's because the previous interface was throwing away useful information - to be precise, the end of the matched range. If you know the length of the pattern that you are searching for, and you have random-access iterators, then recovering the end of the matched range is simple and cheap. However, that's not always the case. Consider a matcher that matches against a regular expression.

I wrote a blog post about this titled "sometimes you get things wrong" here: https://cplusplusmusings.wordpress.com/2016/02/01/sometimes-you-get-things-wrong/

Last edited 6 years ago by Marshall Clow (previous) (diff)

comment:2 by antoinep92@…, 6 years ago

Just for people looking for the porting notes mentioned by marshall, they're available on github here: https://github.com/boostorg/algorithm/blob/develop/doc/boyer_moore.qbk (markup version -- haven't been able to find compiled html).

(please note that the version on SVN trunk is not up to date)

Note: See TracTickets for help on using tickets.