Skip to content

Instantly share code, notes, and snippets.

@csoma
Last active January 1, 2016 07:59
Show Gist options
  • 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