Boost logo

Boost :

Subject: Re: [boost] Heads up - string_ref landing
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2012-11-15 15:32:39


On 11/15/2012 11:39 AM, Olaf van der Spek wrote:
> On Thu, Nov 15, 2012 at 8:19 PM, Marshall Clow <mclow.lists_at_[hidden]> wrote:
>> I'm about to check in some new functionality into the string_algo library; an implementation of string_ref.
> Great!
>> A string_ref is a non-owning reference to a string. It is implemented as a {pointer, length} pair, and is exceedingly useful
>> when parsing, and manipulating strings in "read-only" ways.
> Wouldn't a ptr pair be better?

Why? I don't see that it makes any
difference whatsoever.

>> The header will be in boost/algorithm/string_ref.hpp, but I welcome discussion about where it should live.
>> Ideally, I think it should be just "boost/string_ref.hpp".
> I'd go with the latter.
> I'm missing explicit operator bool() const { return !empty(); }

-1. A string is not a boolean value
nor is an empty string a special invalid
value. If you want to know whether a string
is empty, you should call s.empty().

In Christ,
Steven Watanabe

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