diff --git a/benchmark/util/args.h b/benchmark/util/args.h index 4b001a50..e17f70af 100644 --- a/benchmark/util/args.h +++ b/benchmark/util/args.h @@ -46,6 +46,33 @@ namespace details return true; } + template + inline bool extract_impl(size_t todo, int& index, bool& r, char**& p, Arg& arg){ + if(!r||index>=todo){ + return false; + } + + r = extract(*p, arg); + + if(!r){ + return false; + } + + index++; + p++; + + return true; + } + + template + inline int parse(size_t todo, char ** p, ARGS & ... args) + { + int index = 0; + bool r = true; + (void)std::initializer_list{(extract_impl(todo, index, r, p, args), 0)...}; + return index; + } + template inline int parse(int todo, char ** p, ARGS & ... args) {