Explicit Return Type of Lambda

后端 未结 3 1737
没有蜡笔的小新
没有蜡笔的小新 2020-11-30 23:38

When I try and compile this code (VS2010) I am getting the following error: error C3499: a lambda that has been specified to have a void return type cannot return a va

3条回答
  •  南方客
    南方客 (楼主)
    2020-12-01 00:10

    You can have more than one statement when still return:

    []() -> your_type {return (
            your_statement,
            even_more_statement = just_add_comma,
            return_value);}
    

    http://www.cplusplus.com/doc/tutorial/operators/#comma

提交回复
热议问题