lundi 3 août 2015

What is the life span of an automatic bound to a lamba function?

If an automatic is bound to a lambda function, does the life of the automatic get extended to the life of the lambda function?

Simplest case:

auto genfunc (int start)
{
     int count=start;
     return [&count] {
         return count++;
     };
}

Is this fine, or undefined behavior?

Aucun commentaire:

Enregistrer un commentaire