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
Generic EventProvider
calling conventions and using an override class to change another classes values
new
Waiting for Multiple Objects
template test
std::is_same doesn't check calling convension
iota_30-Seconds-of-C++
problem_solution_1
hgh
operator new / delete