c++ - Find substring in string with iterators -


i have substring defined 2 iterators (start , end). need check if substring present in string.

is there standard library algorithm or string member can use or adapt without creating whole new string object (std::string(start, end)) purpose?

e.g.

struct substring {     std::string::const_iterator start, end; };  auto found = std::contains(whole.begin(), whole.end(), substring.start, substring.end); // ??? 

std::search

bool found =      std::search(hay.begin(), hay.end(), needle.begin(), needle.end()) != hay.end(); 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -