On Tue, Dec 13, 2005 at 11:01:25AM -0600, Thore Karlsen wrote:
split() is declared as follows:
template
SequenceSequenceT & split(SequenceSequenceT & Result, RangeT & Input, PredicateT Pred, token_compress_mode_type eCompress = token_compress_off); Is there a reason why Input isn't const? It would be nice to be able to construct an iterator range in the call to split(), like this:
typedef iterator_rangestring::const_iterator range; vector<range> inputs; split(inputs, range(Begin, End), is_any_of("\r\n"), token_compress_on);
It's the same for find_all(), ifind_all(), and probably others, so there might be a good reason for it that I'm missing.
The const is not missing there. Because the function is templated, const is added to the calculated type. Example: std::string str("Hello world"); const std::string cstr("Good bye world"); split(res, str, pred); // RangeT is substituted to std::string split(res, cstr, pred); // RangeT is substituted to const std::string So you can use the code you have described without problems. Regards, Pavol.