
I am attempting to split a string with the string_algo library, using the code below. It appears that the split algorithm is designed to split on instances of individual characters rather than sequences of characters. Is there something I can do to split on a substring? The code below illustrates the problem, where I am forces to use the is_any_of predicate rather than something that implies equality. It seems like this is a trivial use of the algorithm, so there could easily be something that I am missing. typedef std::vector<boost::iterator_range<char const *> > ResultsType; ResultsType results; static char const STRING[] = "this\r\nis\r\n\r\na test!"; boost::split(results, boost::iterator_range<char const *>(STRING, STRING + sizeof(STRING)), boost::is_any_of("\r\n")); // The problem is here. I would like to be able // to use something like equals, but split requires // a predicate that takes a single argument rather than // a range. for(ResultsType::const_iterator rptr = results.begin(); rptr != results.end(); ++rptr) std::cout << "'" << std::string(rptr->begin(), rptr->end()) << "'\n"; Thanks! David Brownell