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
&&) = 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 temporary. 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. Regards, -- Agustín K-ballo Bergé.- http://talesofcpp.fusionfenix.com