Skip to content

Instantly share code, notes, and snippets.

@pkivolowitz
pkivolowitz / gist:e038e1e9f5ce526189034929394b48a4
Created April 13, 2017 12:04
Example of using a repeated map in proto3 - you're welcome
Row r = sr.row(i);
// r.results_size() tells how many are in map.
google::protobuf::Map<string, string> m = r.results();
cout << left << setw(8) << m["id"];
cout << setw(30) << m["artist"];
cout << setw(36) << m["title"];
cout << setw(10) << m["duration"];
@pkivolowitz
pkivolowitz / gist:83c2b675d1d042e2ff8605ae5c523cbb
Created April 13, 2017 12:08
An example of iterating a proto3 map - you're welcome
google::protobuf::Map<string, string>::iterator it = m.begin();
while (it != m.end())
{
cout << it->first << " " << it->second << endl;
it++;
}