c++ - What is the meaning of the code? -


i have read define function c define, , can not understand usage of [&]() -> long int.is assign type of return of function. can expalain me in detail? thanks

    # define temp_failure_retry(expression)                 \         [&]() -> long int                               \         {                                               \             long int __result;                          \                 __result = (long int)(expression);      \                while (__result == -1l && errno == eintr);  \             return __result;                            \         }() 

it lambda expression of form:
[ captures ] ( params ) -> ret { body }

  • [&] captures automatic variables used in body of lambda reference , current object reference if exists
  • there no parameter
  • return type long int
  • {} contains definition of lambda

for details refer cpp reference link


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -