Boost logo

Boost :

Subject: [boost] [string_ref] Feature requests
From: Daniel James (dnljms_at_[hidden])
Date: 2012-12-29 09:33:02


I've been trying to convert quickbook to use boost::string_ref, and
there are a few missing features that might be useful:

Construction from a pair of iterators, either
std::basic_string::const_iterator, or
boost::basic_string_ref::const_iterator. Which of course can be the
same type, which is annoying but not too hard to work around.

Easy conversion to std::basic_string. There's a C++11 explicit string
operator, but that isn't much good for portable code. Something like a
'string' or 'to_string' member would do the trick.

Support for comparisons with std::basic_string. The comparison
operators are templates so they aren't called with an implicit
conversion. Could use a template parameter for the type so that it
picks up anything which is (implicitly?) convertible to
boost::basic_string_ref, maybe using SFINAE.

I didn't need it, but could probably also could do with a 'hash_value'
function for boost::hash support. Is potentially error prone if the
original string is modified or destroy, but there are some valid use



Boost list run by bdawes at, gregod at, cpdaniel at, john at