From: Gabriel Corona Date: Fri, 30 Mar 2018 21:59:02 +0000 (+0200) Subject: config: fix declareFlag template X-Git-Tag: v3.20~562^2~6^2 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/5343203035034c0e4e1b894ca313a072c58d9183 config: fix declareFlag template --- diff --git a/include/xbt/config.hpp b/include/xbt/config.hpp index d457e57a4e..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