Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiling example mbox under Windows problem: error C2784: '_RanIt1::difference_type std::operator #7

Open
tester0077 opened this issue Feb 18, 2018 · 1 comment

Comments

@tester0077
Copy link

The statements:
Line 155 it = utils::find_bm(bit, eit, "From ");
Line 156 if(!isnl(*(it-1))) >>>>> error C2784: '_RanIt1::difference_type std::operator ......

If I comment out line 156, I get the error
D:\pkg\C++\MSVC2010\mimetic-master\mimetic/utils.h(88): error C2664: 'mimetic::utils::find_bm' : cannot convert parameter 4 from 'std::input_iterator_tag' to 'const std::random_access_iterator_tag &'
1> Reason: cannot convert from 'std::input_iterator_tag' to 'const std::random_access_iterator_tag'
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called

I am unfamiliar enough with STL & mimetic to be able to resolve this issue on my own.
FWIW, using current mimetic-master from github

lukem added a commit to lukem/mimetic that referenced this issue Dec 29, 2023
Use std::search() to implement find_bm() instead of using a
local implementation of Boyer-Moore.

Avoids integer overflow reported in issue tat#31 and PR tat#31.
Should fix build problem in issue tat#7.

std::search is also faster for the test program in issue tat#31
on a system with an Intel Xeon E-2224 CPU:
- gcc 8.5, find_bm(): 3.16s
- g++ 8.5, std::search: 2.40s
- g++ 13, std::search: 2.16s

Experiments using the C++17 std::boyer_moore_searcher or
std::boyer_moore_horspool_searcher were also slower than
std::search in this experiment.
@lukem
Copy link
Contributor

lukem commented Dec 29, 2023

See pull request #33 for a change that may resolve this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants