Last active
January 1, 2016 07:59
-
-
Save csoma/8115693 to your computer and use it in GitHub Desktop.
C++11 example of lightweight data modeling - based on https://gist.github.com/amontalenti/8114383
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <map> | |
#include <string> | |
using namespace std; | |
int main() { | |
auto some_items = {1, 2, 3, 4}; | |
for(auto item : some_items) | |
cout << item << endl; | |
map<string,string> some_mapping = { {"ST","started"}, {"IP","in progress"}, {"DN","done"} }; | |
for (auto& item : some_mapping) { | |
cout << item.first << "=>" << item.second << endl; | |
} | |
return 0; | |
} | |
// See it here: http://ideone.com/ultPV6 | |
// Note: you can get an item by value with "auto" or by reference with "auto&" | |
// Java will always use "by reference" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Python: https://gist.github.com/amontalenti/8114383
Java: https://gist.github.com/amontalenti/8114359
Scala: https://gist.github.com/csoma/8115672