Advertisement
Albinutte

C++ HM

Feb 17th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. #include <iostream>
  2. #include <map>
  3. #include <vector>
  4.  
  5. #include <boost/variant.hpp>
  6.  
  7. typedef boost::variant<
  8.   int,
  9.   bool,
  10.   double,
  11.   std::string,
  12.   char> basic_types;
  13. typedef std::vector<basic_types> array_types;
  14. typedef std::vector<array_types> matrix_types;
  15. typedef boost::variant<basic_types, array_types, matrix_types> all_types;
  16.  
  17. int main() {
  18.   std::map<all_types, all_types> test;
  19.   test[0] = 23;
  20.   test[1] = "hello";
  21.   test[15] = 34.5;
  22.   test["mamma mia!"] = 42;
  23.  
  24.   all_types tt = 42;
  25.   std::cout << (tt == test["mamma mia!"]) << std::endl;
  26.  
  27.   return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement