Sep 6, 2021 at 12:27am
I've been using MSVC 19 happily for a while now, with no particular rush to play with C++20 something...
Until today I tried to use a templated lambda with a parameter pack.
1 2 3 4
|
auto arg_in = [&arg] <typename...Args> ( Args...args ) -> bool
{
return (... || (arg == args));
};
|
MSVC 19 couldn't cut it.
Foo.
[edit] fixed a typo...
Last edited on Sep 6, 2021 at 7:55am
Sep 6, 2021 at 12:29am
2019's 16.11.2 is the panacea you need for that.
There is even a flag/IDE setting to compile against C++20 instead of C++:latest.
Sep 6, 2021 at 1:39am
Yeah, Clang++ 9.0 did it just fine with -std=c++2a.
All for a little readability later, I guess.
Sep 6, 2021 at 4:23am
Didn't test it, but it looks like you wrote template where you should have written typename.
Sep 6, 2021 at 7:56am
Argh. Alas, that was just a typo when posting here.
Sep 6, 2021 at 8:15am
lol, I never saw this syntax anyway, but now it compiles fine..
Sep 7, 2021 at 4:49am
That's something I never saw before. Looks awfully handy.
Welcome to MS22 :)