Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
decltype_lambda
#include <iostream> // In an header: inline auto wrap(int (*f)(int)) { return [f](int i) { return f(i); }; } int foo(int i); //extern decltype(wrap(&foo)) wrapped_foo; // in a cpp, the definition int foo(int i) { return i;} decltype(wrap(foo)) wrapped_foo = wrap(&foo); // and the usage: int func(){ return wrapped_foo(42); } int main() { std::cout << func() << std::endl; }
run
|
edit
|
history
|
help
0
c++ eval - double numbers v1.0
cv3
Wide string conversion with multibyte chars
Template float/int comparison
not a parameter pack
fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt
MSVCStatic
MSVC lambda bug
VS'15 parameter pack sfinae
Regex pipe and tabs c++