#include #include #include #include using namespace std; using namespace boost; using boost::algorithm::find_all; int main(int argc, char* argv[]) { std::string haystack("AAAA"); std::string needle("AAA"); std::list> out; boost::algorithm::find_all(out, haystack, needle); cout << "matches=" << out.size() << endl; BOOST_FOREACH(boost::iterator_range it, out) { cout << (it.begin() - haystack.begin()) << ' '; } cout << endl; return 0; }