From 1803cb6d54c9abd94d6e6d13384e5ee22754c45c Mon Sep 17 00:00:00 2001 From: Charles Dang Date: Wed, 18 Sep 2024 14:20:25 -0400 Subject: [PATCH] Config: fold over one-liner packs --- src/config.hpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/config.hpp b/src/config.hpp index 8d550832521..fa32649ac7c 100644 --- a/src/config.hpp +++ b/src/config.hpp @@ -537,12 +537,9 @@ public: void remove_attribute(config_key_type key); void merge_attributes(const config &); + template - void remove_attributes(T... keys) { - for(const auto& key : {keys...}) { - remove_attribute(key); - } - } + void remove_attributes(T... keys) { (remove_attribute(keys), ...); } /** * Copies attributes that exist in the source config. @@ -604,13 +601,10 @@ public: private: void clear_children_impl(config_key_type key); + public: template - void clear_children(T... keys) { - for(auto key : {keys...}) { - clear_children_impl(key); - } - } + void clear_children(T... keys) { (clear_children_impl(keys), ...); } /** * Moves all the children with tag @a key from @a src to this.