Subject: Re: [boost] Heads up - string_ref landing
From: Rob Stewart (robertstewart_at_[hidden])
Date: 2012-12-12 07:55:21
On Dec 12, 2012, at 2:38 AM, Yakov Galka <ybungalobill_at_[hidden]> wrote:
> On Tue, Dec 11, 2012 at 11:47 PM, Rob Stewart <robertstewart_at_[hidden]>wrote:
>> On Dec 10, 2012, at 7:55 AM, Sergey Cheban <s.cheban_at_[hidden]> wrote:
>>> 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.
>> It is quite intuitive to me. true means non-null, and false means null.
> Would it mean !empty() or !!begin()?
The former certainly. string_ref's are never assumed to be null terminated (which is why I provide data() and not c_str()), so the latter is not sensible.
>> The std::string has no such operator.
>> Why does that matter? It's still convenient. It would be a nice addition to std::string.
> std::string does not have a 'null' state.
It's the state represented by empty().
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk