From: Gabriel Corona Date: Thu, 28 Apr 2016 13:20:46 +0000 (+0200) Subject: [config] Add a template declareFlag(...) X-Git-Tag: v3_14~1316 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/e53ddadb32d93fa0680ac0c7b4d2f9173ab0c3b6 [config] Add a template declareFlag(...) --- 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