Boost logo

Boost :

Subject: Re: [boost] Constructing string_ref from rvalue string
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2017-03-20 08:48:07

This is a misfeature and is inconsistent with std::string_view.
I just made a ticket for it here

On 17 March 2017 at 07:29, Simon Sasburg via Boost <boost_at_[hidden]>

> 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?
> Simon
> _______________________________________________
> Unsubscribe & other changes:
> mailman/listinfo.cgi/boost

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