Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <inttypes.h>
- #include <string>
- #include <unordered_map>
- #include <iostream>
- struct data {
- uint32_t thing;
- uint32_t thing2;
- };
- std::unordered_map<std::string, data> get_things() {
- return {
- { "something1", {0, 1} },
- { "something2", {1, 2} }
- };
- }
- int main(int argc, char **argv) {
- const data& thing = get_things()["something1"];
- std::cout << thing.thing << std::endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement