Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Error defining lambda inside namespace
#include <unordered_map> #include <string> #include <functional> #include <iostream> namespace test { struct A { static const std::unordered_map<std::string, std::function<void(const std::string &)>> a; static void call(const std::string &str) { a.at(str)(str); } }; const std::unordered_map<std::string, std::function<void(const std::string &)>> A::a { {"Hello", [](const auto &str) { std::cout << str << " World" << std::endl; } } }; } int main() { test::A::call("Hello"); return 0; }
run
|
edit
|
history
|
help
0
Static cast of Enum
throwing Copyable versus throwing MoveOnly
Matrix_1
a parameter pack
copy
wrong up
visual-wtf
Template float/int comparison
Dequeue Using STL List
std::function ambiguity vc++