jeudi 28 mai 2020

Returning value from lambda in the same line with declaration

Sometimes it is easier to represent a value by function, and lambdas are good for this. But is there any way to return value from lambda declaration?

for example:

int i = []{return 2;};

generates an error. How to make that lambda declaration return 2 without any new lines of code?

Aucun commentaire:

Enregistrer un commentaire