From fc8eef3ae1ea7d04fa06109024b2c72cd8c37454 Mon Sep 17 00:00:00 2001 From: Lucas Czech Date: Thu, 12 Apr 2018 08:36:55 +0200 Subject: [PATCH] Keep original group order --- include/CLI/App.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/CLI/App.hpp b/include/CLI/App.hpp index 4319c25c..bfaaa914 100644 --- a/include/CLI/App.hpp +++ b/include/CLI/App.hpp @@ -904,11 +904,15 @@ class App { // Check for options_ bool npos = false; - std::set groups; + std::vector groups; for(const Option_p &opt : options_) { if(opt->nonpositional()) { npos = true; - groups.insert(opt->get_group()); + + // Add group if it is not already in there + if(std::find(groups.begin(), groups.end(), opt->get_group()) == groups.end()) { + groups.push_back(opt->get_group()); + } } }