+ using iterator = std::vector<extended_option>::iterator;
+ using const_iterator = std::vector<extended_option>::const_iterator;
+ using predicate = std::function<bool(const extended_option &ext)>;
+
+ const_iterator find(const predicate &pred) const {
+ return std::find_if(options.cbegin(), options.cend(), pred);
+ }
+ const_iterator find(const std::string &name) const {
+ return find([&name](const extended_option &ext) {
+ return ext.opt.name && ext.opt.name == name;
+ });
+ }
+ const_iterator find(int c) const {
+ return find([c](const extended_option &ext) {
+ return ext.opt.val == c || (c == 1 && ext.opt.val == '-');
+ });
+ }
+
+ iterator find(const predicate &pred) {
+ return std::find_if(options.begin(), options.end(), pred);
+ }
+ iterator find(const std::string &name) {
+ return find([&name](const extended_option &ext) {
+ return ext.opt.name && ext.opt.name == name;
+ });
+ }
+ iterator find(int c) {
+ return find([c](const extended_option &ext) {
+ return ext.opt.val == c || (c == 1 && ext.opt.val == '-');
+ });
+ }