C++ Logo

SG20

Advanced search

Subject: Re: A draft paper to fix the range-based for loop to make it teachable
From: Arthur O'Dwyer (arthur.j.odwyer_at_[hidden])
Date: 2020-11-11 16:10:44


On Wed, Nov 11, 2020 at 12:58 PM Peter C++ <peter.cpp_at_[hidden]> wrote:

>
> The crux of dangling in many cases are member functions returning
> references (or pointers of views) If those functions would be
> lvalue-ref-qualified this dangling can not happen.
>

This is a common misconception. Consult my blog post "Value category is not
lifetime":
https://quuxplusone.github.io/blog/2019/03/11/value-category-is-not-lifetime/

-Arthur



SG20 list run by sg20-owner@lists.isocpp.org

Older Archives on Google Groups