I am looking at our C++20 support. I have some trouble that I wonder if somebody can help out with.
I fail to create a compilable example for this feature: https://github.com/AnthonyCalandra/modern-cpp-features/blob/master/CPP20.md#template-syntax-for-lambdas. I assume something like this should work:
int foo() { auto zero = []<class T>() { return T(0); }; return zero<int>(); }
I would also like help with this: https://github.com/AnthonyCalandra/modern-cpp-features/blob/master/CPP20.md#class-types-in-non-type-template-parameters
I fail to compile the code below:
struct foo { foo() = default; constexpr foo(int) {} }; template <foo f> auto get_foo() { return f; } int main() { get_foo(); // uses implicit constructor get_foo<foo{123}>(); return 0; }
Log in to post a comment.
I am looking at our C++20 support. I have some trouble that I wonder if somebody can help out with.
I fail to create a compilable example for this feature: https://github.com/AnthonyCalandra/modern-cpp-features/blob/master/CPP20.md#template-syntax-for-lambdas. I assume something like this should work:
Last edit: Daniel Marjamäki 2021-04-24
I would also like help with this: https://github.com/AnthonyCalandra/modern-cpp-features/blob/master/CPP20.md#class-types-in-non-type-template-parameters
I fail to compile the code below: