Boost logo

Boost :

Subject: Re: [boost] Heads up - string_ref landing
From: Dave Abrahams (dave_at_[hidden])
Date: 2012-12-15 17:48:18


on Wed Dec 12 2012, Gottlob Frege <gottlobfrege-AT-gmail.com> wrote:

> On Wed, Dec 12, 2012 at 10:49 AM, Rob Stewart <robertstewart_at_[hidden]>wrote:
>
>> >>>
>> >>> std::string does not have a 'null' state.
>> >>
>> >> It's the state represented by empty().
>> >
>> > I am not sure it is so certainly accepted by all.
>>
>> It is the logical interpretation. It indicates whether the string is
>> non-empty. I don't see any other generally useful interpretation, do you?
>>
>>
>
> Qt's QString has both empty() and isNull() and they are not always the
> same. Basically empty() is a zero-byte string, but null is a
> never-been-set-or-allocated string.

That's dumb, though.

> ie
>
> QString name = database.get("Name");
>
> name.empty() == true means the Name field was empty
> name.isNull() == true means the Name field doesn't exist in the database.
>
> Somewhat like optional<string>.
>
> I am NOT saying whether this is a good thing. Just a widely known example
> of interpretation.

I AM saying it's a bad thing! :-)

-- 
Dave Abrahams
BoostPro Computing                  Software Development        Training
http://www.boostpro.com             Clang/LLVM/EDG Compilers  C++  Boost

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk