From 2213b3d2b8fc160d21f4a293720cf081426befcb Mon Sep 17 00:00:00 2001 From: Rebecca Turner Date: Fri, 9 Feb 2024 09:35:06 -0800 Subject: [PATCH] Remove `bool` argument and add default value for `handler` --- src/libutil/config.hh | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/libutil/config.hh b/src/libutil/config.hh index 090423dbf6c..75f1d4e8894 100644 --- a/src/libutil/config.hh +++ b/src/libutil/config.hh @@ -222,17 +222,11 @@ protected: template struct SettingHandler { - /** - * The `bool` argument is `true` if the value is being set to the default - * value. - * - * The `T &` argument is the value itself. - */ - std::function fun; + std::function fun = [](T & val) {}; SettingHandler() = default; - SettingHandler(std::function && fun) + SettingHandler(std::function && fun) : fun(std::move(fun)) { } @@ -294,9 +288,7 @@ public: , handler(handler) { options->addSetting(this); - if (handler) { - handler.fun(true, value); - } + handler.fun(value); } operator const T &() const { return value; } @@ -314,9 +306,7 @@ public: virtual void assign(const T & v) { value = v; - if (handler) { - handler.fun(false, value); - } + handler.fun(value); } void operator =(const T & v) { assign(v); }