Skip to content

Instantly share code, notes, and snippets.

@picanumber
Created January 11, 2017 12:23
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 picanumber/b1128c037a3e152979d480a44869b758 to your computer and use it in GitHub Desktop.
Save picanumber/b1128c037a3e152979d480a44869b758 to your computer and use it in GitHub Desktop.
Showcase the use of sorted view
// 1. Create the sorted view
auto sv = make_sorted_view(first_name, last_name, country, sport,
years, gender, medals_gold, medals_silver, medals_bronze, medals_total);
sv.sort<0>(std::less<>{}); // 2. Sort by first name
for (size_t i = 0; i < sv.size<0>(); i++) printf("{ %s-%s-%s }\n",
sv.at<0>(i).c_str(), // 3. access the ith sorted element of sequence 0
sv.at<1>(i).c_str(),
sv.at<2>(i).c_str());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment