Boost logo

Boost :

Subject: Re: [boost] Constructing string_ref from rvalue string
From: Marshall Clow (mclow.lists_at_[hidden])
Date: 2017-03-24 03:39:07

On Fri, Mar 17, 2017 at 12:29 AM, Simon Sasburg via Boost <
boost_at_[hidden]> wrote:

> I've just tested our codebase with the 1.64.0 master snapshot, and i've
> encountered an issue which i've tracked down to this commit:
> 1f76d2cb55
> Basically this removes the constructor which allows constructing a
> boost::string_ref from an rvalue std::string. I am wondering if this is
> really that dangerous. In our codebase we almost exlusively use
> boost::string_ref as function parameters, with the understanding that
> passed string_refs parameters are only valid within the function body. (so
> you need to copy it into an std::string if you need to access it
> afterwards)
> With these constraints i think it is OK to construct a string_ref from an
> rvalue std::string because the temporary should live long enough. (but
> please correct me if i'm wrong here)
> Is the safety (?) added by this commit worth it if it breaks working code?
I'll also point out that that commit was in response to this bug report:

-- Marshall

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