Boost logo

Boost Users :

Subject: [Boost-users] boost::split_regex
From: Brad Tilley (kj4eit_at_[hidden])
Date: 2012-01-18 10:39:24


I'm experimenting with boost::split_regex and ran into an issue. The
first three examples (results1, results2, results3) compile and work
as expected. The last one (results4) does not compile. Here's the code
I'm using:

std::string str1("hello abc-ABC-aBc goodbye");
static const boost::regex re("-ABC-");

std::vector<boost::iterator_range<std::string::iterator> > results1;
boost::ifind_all( results1, str1, "abc" );

std::vector<boost::iterator_range<std::string::iterator> > results2;
boost::split(results2, str1, boost::is_any_of("-"));

std::vector<std::string> results3;
boost::split_regex(results3, str1, re);

std::vector<boost::iterator_range<std::string::iterator> > results4;
// compile error on this line:
boost::split_regex(results4, str1, re);

I've read the documents here: http://www.boost.org/doc/libs/1_48_0/doc/html/boost/algorithm/split_regex.html
and I believe my usage of split_regex is correct? It compiles and
works with std::string (results3) but not with boost::iterator_range.
The compiler error is long and verbose, so I'm hesitant to post it
here. I was hoping that someone could look at the usage example I
provided and see how I'm doing it wrong. I prefer iterator_range as it
does not make a copy.

Thanks for any advice!

Brad


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net