1
0
mirror of https://github.com/CLIUtils/CLI11.git synced 2025-05-01 13:13:53 +00:00

Minor cleanup to inter_arg_order

This commit is contained in:
Henry Fredrick Schreiner 2017-06-05 08:37:23 -04:00
parent deae513900
commit 04268dac5a

View File

@ -2,6 +2,7 @@
#include <iostream> #include <iostream>
#include <vector> #include <vector>
#include <tuple> #include <tuple>
#include <algorithm>
int main(int argc, char **argv) { int main(int argc, char **argv) {
CLI::App app; CLI::App app;
@ -25,7 +26,7 @@ int main(int argc, char **argv) {
std::reverse(std::begin(foos), std::end(foos)); std::reverse(std::begin(foos), std::end(foos));
std::reverse(std::begin(bars), std::end(bars)); std::reverse(std::begin(bars), std::end(bars));
std::vector<std::tuple<std::string, int>> keyval; std::vector<std::pair<std::string, int>> keyval;
for(auto option : app.parse_order()) { for(auto option : app.parse_order()) {
if(option == foo) { if(option == foo) {
keyval.emplace_back("foo", foos.back()); keyval.emplace_back("foo", foos.back());
@ -38,11 +39,7 @@ int main(int argc, char **argv) {
} }
// Prove the vector is correct // Prove the vector is correct
std::string name; for(auto &pair : keyval) {
int value; std::cout << pair.first << " : " << pair.second << std::endl;
for(auto &tuple : keyval) {
std::tie(name, value) = tuple;
std::cout << name << " : " << value << std::endl;
} }
} }