News for hackers. Stuff that matters.
Re:Rust lifetimes: Getting away with things that would be re... by dbaupp on Saturday September 20, 2014 @06:33AM (#8344208)
I would think that (in C++14 at least), std::string_view would be more appropriate than both?

http://en.cppreference.com/w/cpp/header/experimental/string_...

Re:Rust lifetimes: Getting away with things that would be re... by seabee on Saturday September 20, 2014 @06:48AM (#8344225)
Using string_view in this example doesn't solve the use-after-free bug.

If you are concerned about memory safety, the only appropriate choices are to copy the string and have the string_view objects share ownership, or to use the primitive index range idea and punt the problem back to the programmer.

Re:Rust lifetimes: Getting away with things that would be re... by dbaupp on Saturday September 20, 2014 @07:07AM (#8344255)
Yep, definitely, I was just responding to the question of which view-into-a-string type is the most appropriate.