X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/0542dca1b5c334f0482f3dd62a21faa017a884c5..95199f4ffa751d3614a07fefe6b3caa6deca1b97:/include/xbt/config.hpp?ds=inline diff --git a/include/xbt/config.hpp b/include/xbt/config.hpp index a274225de1..236d87f962 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