Commit 04268dac5a945b39fd3d7fc80b297aed1a7d8719
1 parent
deae5139
Minor cleanup to inter_arg_order
Showing
1 changed file
with
4 additions
and
7 deletions
examples/inter_argument_order.cpp
| ... | ... | @@ -2,6 +2,7 @@ |
| 2 | 2 | #include <iostream> |
| 3 | 3 | #include <vector> |
| 4 | 4 | #include <tuple> |
| 5 | +#include <algorithm> | |
| 5 | 6 | |
| 6 | 7 | int main(int argc, char **argv) { |
| 7 | 8 | CLI::App app; |
| ... | ... | @@ -25,7 +26,7 @@ int main(int argc, char **argv) { |
| 25 | 26 | std::reverse(std::begin(foos), std::end(foos)); |
| 26 | 27 | std::reverse(std::begin(bars), std::end(bars)); |
| 27 | 28 | |
| 28 | - std::vector<std::tuple<std::string, int>> keyval; | |
| 29 | + std::vector<std::pair<std::string, int>> keyval; | |
| 29 | 30 | for(auto option : app.parse_order()) { |
| 30 | 31 | if(option == foo) { |
| 31 | 32 | keyval.emplace_back("foo", foos.back()); |
| ... | ... | @@ -38,11 +39,7 @@ int main(int argc, char **argv) { |
| 38 | 39 | } |
| 39 | 40 | |
| 40 | 41 | // Prove the vector is correct |
| 41 | - std::string name; | |
| 42 | - int value; | |
| 43 | - | |
| 44 | - for(auto &tuple : keyval) { | |
| 45 | - std::tie(name, value) = tuple; | |
| 46 | - std::cout << name << " : " << value << std::endl; | |
| 42 | + for(auto &pair : keyval) { | |
| 43 | + std::cout << pair.first << " : " << pair.second << std::endl; | |
| 47 | 44 | } |
| 48 | 45 | } | ... | ... |