Created
January 11, 2017 12:23
-
-
Save picanumber/b1128c037a3e152979d480a44869b758 to your computer and use it in GitHub Desktop.
Showcase the use of sorted view
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
// 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