Boost logo

Boost :

Subject: Re: [boost] Constructing string_ref from rvalue string
From: Olaf van der Spek (ml_at_[hidden])
Date: 2017-03-23 07:57:38


On Wed, Mar 22, 2017 at 11:38 PM, Gavin Lambert via Boost
<boost_at_[hidden]> wrote:
> On 23/03/2017 03:28, Olaf van der Spek via Boost wrote:
>>
>> void f2(const string&);
>> string f1();
>>
>> f1(f2());
>>
>> Isn't this a very common pattern?
>
>
> Yes (although you have it reversed), but that's not what we were talking
> about.

It's the same underlying issue, replacing const string& by string_view
doesn't change it.

> We were talking about this:
>
> void f1(const string_ref&);
> string f2();
>
> f1(f2());
>
> Or this:
>
> void f1(const string_ref&);

AFAIK string_ref should be passed by value, not by const&.

-- 
Olaf

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