> - drop the requirement for () in lambdas
> 
> Rationale: this was a word-around for older MSVCs. The standard doesn't
> require the empty parameter list (except when adorning the lambda with
> noexcept etc, and then the compiler complains) and people have voted
> with their feet: we now have many uses of [] {} in Qt already.

I support it and we have such a rule in QtC already. However, please note that 
when you specify the return type of
the lambda or define it mutable, the compiler issues the following warnings 
currently:

    int bla = 0;
    const auto foo = [] -> int { return 0; };
    const auto bar = [bla] mutable { bla = 4; return 0; };

warning: parameter declaration before lambda trailing return type only optional 
with ‘-std=c++2b’ or ‘-std=gnu++2b’
   72 |     const auto foo = [] -> int { return 0; };
      |                         ^~
warning: parameter declaration before lambda declaration specifiers only 
optional with ‘-std=c++2b’ or ‘-std=gnu++2b’
   73 |     const auto bar = [bla] mutable { bla = 4; return 0; };
      |                            ^~~~~~~

When you add empty (), the compiler is silent.

Jarek
-- 
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development

Reply via email to