On Tuesday, 16 September 2014 at 15:30:49 UTC, Andrei
Alexandrescu wrote:
The function get_url() returns an rvalue, which in turn gets
bound to a reference to const and implicitly passed to
string_view's constructor. The obtained view refers to a dead
string.
When I saw this idiom used in D, I asked the same question: how
long the temporary should survive? Does it work more reliably in
D? It would be ok if it survives till the end of the scope,
optimization opportunities lost this way should be small enough.