fork(1) download
  1. #include <iostream>
  2. #include <map>
  3.  
  4. std::map<std::string, void(*)()> myMap;
  5.  
  6. #define LUAVOID(FN, ...) \
  7.   void FN(); \
  8.   static auto addFN ## __LINE__ = myMap.emplace(#FN, FN); \
  9.   void FN()
  10.  
  11. LUAVOID(TextMsg, string s)
  12. {
  13. std::cout << "hello!\n";
  14. }
  15.  
  16. int main()
  17. {
  18. (myMap.find("TextMsg")->second)();
  19. }
Success #stdin #stdout 0s 3276KB
stdin
Standard input is empty
stdout
hello!