So, let's look at boost::algorithm::split_regex
. You're doing well until the last parameter. That function expects a boost::regex as the last parameter, and boost::is_any_of
does not provide one of those.
A reasonable regular expression for your use case would be something like this:
boost::regex r("(<=>)|(=>)");
If we put all of this together:
#include <vector>
#include <string>
#include <iostream>
#include <boost/regex.hpp>
#include <boost/algorithm/string/regex.hpp>
int main() {
std::string example="A + B => C + D";
std::vector <std::string> leftRight;
boost::regex r("(<=>)|(=>)");
boost::algorithm::split_regex(leftRight, example, r);
for (int i=0; i<leftRight.size(); ++i)
std::cout << "\"" << leftRight[i] << "\"\n";
}
We get an output of:
"A + B "
" C + D"