Subject: Re: [boost] [utility] string_ref construction from rvalue reference to string
From: AgustÃn K-ballo BergÃ© (kaballo86_at_[hidden])
Date: 2014-08-01 18:34:29
On 31/07/2014 04:53 a.m., ÐÐ½Ð´ÑÐµÐ¹ ÐÐ°Ð²ÑÐ´Ð¾Ð² wrote:
> Those errors can be caught at compile time if class "basic_string_ref"
> defintion would contain lines like following:
> template<typename Allocator>
> basic_string_ref(std::basic_string<charT, traits, Allocator> &&) = delete;
> I cannot understant does it prevent any correct usage of string_ref?
I don't think this is such a good idea. Unless I'm mistaken, it would
break the typical case of calling a function taking a `string_ref` with
A `string_ref` does not own the contents it represents, and the only way
to use it correctly is by guaranteeing that the lifetime of the contents
extends past that of the reference. You wouldn't generally use
`string_ref`s as automatic variables or members.
-- AgustÃn K-ballo BergÃ©.- http://talesofcpp.fusionfenix.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk