|
Boost : |
Subject: Re: [boost] Heads up - string_ref landing
From: Gottlob Frege (gottlobfrege_at_[hidden])
Date: 2012-12-12 12:30:14
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.
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.
Tony
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk