Skip to content

Instantly share code, notes, and snippets.

@csoma
Last active January 1, 2016 07:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save csoma/8115693 to your computer and use it in GitHub Desktop.
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
#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