Advertisement
Barteks2x

Untitled

Jul 13th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include <inttypes.h>
  2. #include <string>
  3. #include <unordered_map>
  4. #include <iostream>
  5.  
  6. struct data {
  7.     uint32_t thing;
  8.     uint32_t thing2;
  9. };
  10.  
  11. std::unordered_map<std::string, data> get_things() {
  12.     return {
  13.             { "something1", {0, 1} },
  14.             { "something2", {1, 2} }
  15.     };
  16. }
  17.  
  18.  
  19. int main(int argc, char **argv) {
  20.     const data& thing = get_things()["something1"];
  21.     std::cout << thing.thing << std::endl;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement