Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::split_regex
From: Brad Tilley (kj4eit_at_[hidden])
Date: 2012-01-18 13:20:35

I think I've got it now... re-reading the docs, this approach seems to

std::vector<boost::iterator_range<std::string::iterator> > results4;
boost::split_regex(results4, boost::make_iterator_range(str1.begin(),
str1.end()), re);

On Jan 18, 10:39 am, Brad Tilley <kj4..._at_[hidden]> wrote:
> 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:
> 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, kalb at, bjorn.karlsson at, gregod at, wekempf at