From e53ddadb32d93fa0680ac0c7b4d2f9173ab0c3b6 Mon Sep 17 00:00:00 2001 From: Gabriel Corona Date: Thu, 28 Apr 2016 15:20:46 +0200 Subject: [PATCH] [config] Add a template declareFlag(...) --- include/xbt/config.hpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/xbt/config.hpp b/include/xbt/config.hpp index 42f8fdfd74..1be433bbad 100644 --- a/include/xbt/config.hpp +++ b/include/xbt/config.hpp @@ -98,6 +98,14 @@ inline std::string to_string(std::string&& value) XBT_PUBLIC(void) declareFlag(const char* name, const char* description, std::function callback); +template +XBT_PUBLIC(void) declareFlag(const char* name, const char* description, F callback) +{ + declareFlag(name, description, [callback](const char* value) { + callback(parse(value)); + }); +} + /** Bind a variable to configuration flag * * @param value Bound variable -- 2.20.1