X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/1acdb6e20d63bf8987e6fbcf65e40949831a206d..5343203035034c0e4e1b894ca313a072c58d9183:/include/xbt/config.hpp diff --git a/include/xbt/config.hpp b/include/xbt/config.hpp index 4e0e22221f..6c61a46bef 100644 --- a/include/xbt/config.hpp +++ b/include/xbt/config.hpp @@ -146,10 +146,12 @@ typename std::enable_if([&value,callback](const T& val) { + callback(val); + value = std::move(val); + } + )); } /** Bind a variable to configuration flag @@ -168,11 +170,13 @@ typename std::enable_if([&value, callback](const T& val) { + if (not callback(val)) + throw std::range_error("invalid value"); + value = std::move(val); + }) + ); } /** A variable bound to a CLI option @@ -238,5 +242,6 @@ public: } } +XBT_PUBLIC(std::string) xbt_cfg_get_string(const char* name); #endif