X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/a533788a1f7e6c2e4fd90d40e43b0b5bf4a7e8fe..88fad0aaff9eb463f048bfdfe4ad6218aba44ddb:/include/xbt/config.hpp diff --git a/include/xbt/config.hpp b/include/xbt/config.hpp index a4e7517287..1ce01c3b2b 100644 --- a/include/xbt/config.hpp +++ b/include/xbt/config.hpp @@ -145,10 +145,12 @@ typename std::enable_if([&value,callback](const T& val) { + callback(val); + value = std::move(val); + } + )); } /** Bind a variable to configuration flag @@ -167,11 +169,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