Boost logo

Boost :

Subject: Re: [boost] Heads up - string_ref landing
From: Yanchenko Maxim (maximyanchenko_at_[hidden])
Date: 2012-11-18 22:42:56


> There is no need to detect anything.
>
> string_ref is defined like so
>
> string_ref::string_ref(const char* s) : ptr(s), size(strlen(s)) {}

Mathias, it's not just compile-time size (which is good to have as well, btw).
What about literals with a zero character inside, like "foo\0bar"?
I believe string_ref should be able to handle the case, in order to be useful.

That's why I'm proposing literal and from_array constructor functions (please see my other email with examples).

And I'd like to see them explicit for clear expression of ownership (while Olaf seems to be in strong opposition to this).

Maxim


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