boost::algorithm::contains

后端 未结 1 1997
伪装坚强ぢ
伪装坚强ぢ 2021-01-20 01:49

I looked at the template definition and the parameters appear to want iterators across a range and a predicate. I passed in a vector.begin(), ...end(), and a std::string pr

相关标签:
1条回答
  • 2021-01-20 02:36

    It's fairly simple, I guess you are passing iterators when you should be passing containers.

      std::string s = "fishing"; 
      std::cout << boost::algorithm::contains(s, "is") << std::endl; 
      std::vector<int> v {1,2,3,5,7,2,7,4,5,8};
      std::vector<int> v2 {5,7,2,7,4};
      std::vector<int> v3 {5,7,2,7,3};
      std::cout << boost::algorithm::contains(v, v2) << std::endl;
      std::cout << boost::algorithm::contains(v, v3) << std::endl;
    
    0 讨论(0)
提交回复
热议问题