split_iterator not working with a reference to const std::string
Hi, Here is my code: struct CharIterator { CharIterator( const std::string &s, char_t const *delimiters) : s_(s), begin_(boost::algorithm::split_iteratorstd::string::iterator(s, boost::token_finder(boost::is_any_of(delimiters), boost::token_compress_off))), end_(boost::algorithm::split_iteratorstd::string::iterator()), i_(begin_) { } const std::string s_&; boost::algorithm::split_iteratorstd::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
On 4/9/2012 4:25 AM, asif saeed wrote:
Hi,
Here is my code:
struct CharIterator { CharIterator( const std::string &s, char_t const *delimiters) :s_(s), begin_(boost::algorithm::split_iteratorstd::string::iterator(s, boost::token_finder(boost::is_any_of(delimiters), boost::token_compress_off))), end_(boost::algorithm::split_iteratorstd::string::iterator()), i_(begin_) { }
const std::string s_&; boost::algorithm::split_iteratorstd::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?
Try using std::string::const_iterator. Jeff
participants (2)
-
asif saeed
-
Jeff Flinn