Open district10 opened 2 years ago
https://wandbox.org/permlink/SOdwYcGYX9nThRXx
types.hpp
HANDLE_TYPE(int) HANDLE_TYPE(double) HANDLE_TYPE(std::string)
main.cpp
#include <iostream> #include <map> #include <string> int main() { std::map<std::string, std::string> cache; #define HANDLE_TYPE(Type) cache[#Type] = #Type; #include "types.hpp" for (auto &pair: cache) { std::cout << pair.first << ": " << pair.second << std::endl; } return 0; }
It prints out:
double: double int: int std::string: std::string
#include <iostream> #include <map> #include <string> std::map<std::string, std::string> cache; #define HANDLE_TYPE(Type) cache[#Type] = #Type; #include "/tmp/types.hpp" for (auto &pair: cache) { std::cout << pair.first << ": " << pair.second << std::endl; }
Maybe it's more like a cling thing. :sad:
Testing code
https://wandbox.org/permlink/SOdwYcGYX9nThRXx
types.hpp
main.cpp
It prints out:
It does not work under jupyterlab xeus-cling
Maybe it's more like a cling thing. :sad: