|
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
https://svn.boost.org/trac/boost/ticket/12917
On 17 March 2017 at 07:29, 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:
>
> https://github.com/boostorg/utility/commit/9960d9f395b79ee860e39064cd4696
> 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: http://lists.boost.org/
> mailman/listinfo.cgi/boost
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk