Boost logo

Boost :

Subject: Re: [boost] Heads up - string_ref landing
From: Sergey Cheban (s.cheban_at_[hidden])
Date: 2012-12-10 07:55:00

On 09.12.2012 17:13, Rob Stewart wrote:

>>> - safe bool or explicit bool conversion operator
>> I don't think this is a good idea.
> Why not?
This seems to be not intuitive and not so safe. The std::string has no
such operator.

>>> - char const * data()
>>> - size_t length()
>> I propose the alias size().
> string_ref isn't a container like string, so I prefer just length().

>>> (I think that's a complete list. I'm doing it from memory now.)
>> What about pop_back(), pop_front(), swap()?
> string_ref isn't a container, so pop_back() and pop_front() are inappropriate. However, back(), front(), and swap() are reasonable.
It is not a container (i.e., it does not own the content) but pop_*
methods still may remove the characters from it.

Btw, there also are [r]find*(), r[c]begin()/r[c]end() and compare()
groups of methods in the std::basic_string.

>> And again, I propose "substring" instead of "string_ref".
> I also have [const_]substring classes which have a different interface, so I disagree. (There is, of course, some overlap.)
1. Are these classes in the Boost library and/or namespace?
2. Do these classes do a different job, or they just have a different

Sergey Cheban

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