Boost logo

Boost :

Subject: Re: [boost] Heads up - string_ref landing
From: Yakov Galka (ybungalobill_at_[hidden])
Date: 2012-11-23 07:07:22


On Sat, Nov 17, 2012 at 11:29 PM, Mathias Gaunard <
mathias.gaunard_at_[hidden]> wrote:

> On 16/11/12 15:50, Maxim Yanchenko wrote:
>
>> Mathias Gaunard <mathias.gaunard <at> ens-lyon.org> writes:
>>
>> If this is all you need, just use plain references.
>>>>
>>>
>>> void f(std::string const&);
>>> f("Olaf");
>>>
>>> does make a useless copy.
>>>
>>
>> OK. I thought you were talking about Olaf's desire to have implicit
>> conversion
>> from std::string.
>> For this we use just
>> f(char_range::literal("Olaf"))**;
>>
>
> basic_string_ref<T> is meant to when being implicitly constructed from a
> T(&)[N] or T const* that it is null-terminated.
>

Important point! Current wording does not require the string_ref to point
to a null terminated string. This (a) enables working with substrings, (b)
makes it unclear how it is better than iterator_range, and (c) does not
solve the problem for the fstream::fopen(const char*/std::string&) case.

Do you really think that trading (c) for (a) is a good idea?

-- 
Yakov

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