aboutsummaryrefslogtreecommitdiff
path: root/args.hxx
diff options
context:
space:
mode:
authorTaylor C. Richberger <Taywee@gmx.com>2016-07-07 16:33:37 -0600
committerTaylor C. Richberger <Taywee@gmx.com>2016-07-07 16:33:37 -0600
commit7d4256587393ca6714368f54091cbc7f4deddd61 (patch)
tree47fcfb695bc07014c1b18cc0a18ada399e68b28f /args.hxx
parentcorrect wordings (diff)
downloadargs.hxx-7d4256587393ca6714368f54091cbc7f4deddd61.tar.xz
switch pages to a submodule
Diffstat (limited to 'args.hxx')
-rw-r--r--args.hxx18
1 files changed, 6 insertions, 12 deletions
diff --git a/args.hxx b/args.hxx
index 39fbdea..f2a45b9 100644
--- a/args.hxx
+++ b/args.hxx
@@ -585,7 +585,9 @@ namespace args
std::function<bool(const Group &)> validator;
public:
+ /// If help is empty, this group will not be printed in help output
Group(const std::string &help = std::string(), const std::function<bool(const Group &)> &validator = Validators::DontCare) : Base(help), validator(validator) {}
+ /// If help is empty, this group will not be printed in help output
Group(Group &group, const std::string &help = std::string(), const std::function<bool(const Group &)> &validator = Validators::DontCare) : Base(help), validator(validator)
{
group.Add(*this);
@@ -673,7 +675,7 @@ namespace args
/** Get all this group's children
*/
- const std::vector<Base *> Children() const
+ const std::vector<Base *> &Children() const
{
return children;
}
@@ -813,17 +815,9 @@ namespace args
static bool AllChildGroups(const Group &group)
{
- for (const auto child: group.Children())
- {
- if (const auto group = dynamic_cast<Group *>(child))
- {
- if (!group->Matched())
- {
- return false;
- }
- }
- }
- return true;
+ return std::find_if(std::begin(group.Children()), std::end(group.Children()), [](const Base* child) -> bool {
+ return dynamic_cast<const Group *>(child) && !child->Matched();
+ }) == std::end(group.Children());
}
static bool DontCare(const Group &group)