Boost logo

Boost Users :

Subject: [Boost-users] split_iterator not working with a reference to const std::string
From: asif saeed (asif.lse2_at_[hidden])
Date: 2012-04-09 04:25:06


Hi,

Here is my code:

struct CharIterator
{
CharIterator( const std::string &s, char_t const *delimiters)
: s_(s),
begin_(boost::algorithm::split_iterator<std::string::iterator>(s,
boost::token_finder(boost::is_any_of(delimiters),
boost::token_compress_off))),
end_(boost::algorithm::split_iterator<std::string::iterator>()),
i_(begin_)
{
}

const std::string s_&;
boost::algorithm::split_iterator<std::string::iterator> begin_, end_, i_;
};

The compile gives me an error on parameter 1 of the above constructor. It
compiles fine if I change "const std::string &s" to "std::string s" - that
is, pass by value. I just want to store a reference to a string. Could you
help me on this?

Best regards, Asif



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