X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/081a38309c637c51f527b507704b65d6ce1ac805..3b2902c688d1c3a76ae372001811f51c160484f5:/include/xbt/config.hpp diff --git a/include/xbt/config.hpp b/include/xbt/config.hpp index eeca2250f0..87343a0c19 100644 --- a/include/xbt/config.hpp +++ b/include/xbt/config.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016-2020. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2016-2021. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -132,7 +132,7 @@ void bind_flag(T& value, const char* name, std::initializer_list al */ // F is a checker, F : T& -> () template -typename std::enable_if()(std::declval()))>::value, void>::type +typename std::enable_if_t()(std::declval()))>::value, void> bind_flag(T& value, const char* name, const char* description, F callback) { declare_flag(name, description, value, std::function([&value, callback](const T& val) { @@ -142,7 +142,7 @@ bind_flag(T& value, const char* name, const char* description, F callback) } template -typename std::enable_if()(std::declval()))>::value, void>::type +typename std::enable_if_t()(std::declval()))>::value, void> bind_flag(T& value, const char* name, std::initializer_list aliases, const char* description, F callback) { bind_flag(value, name, description, std::move(callback)); @@ -150,16 +150,16 @@ bind_flag(T& value, const char* name, std::initializer_list aliases } template -typename std::enable_if()(std::declval()))>::value, - void>::type +typename std::enable_if_t()(std::declval()))>::value, + void> bind_flag(std::string& value, const char* name, const char* description, - const std::map& valid_values, F callback) + const std::map>& valid_values, F callback) { declare_flag(name, description, value, std::function([&value, name, valid_values, callback](const std::string& val) { callback(val); if (valid_values.find(val) != valid_values.end()) { - value = std::move(val); + value = val; return; } std::string mesg = "\n"; @@ -173,10 +173,10 @@ bind_flag(std::string& value, const char* name, const char* description, })); } template -typename std::enable_if()(std::declval()))>::value, - void>::type +typename std::enable_if_t()(std::declval()))>::value, + void> bind_flag(std::string& value, const char* name, std::initializer_list aliases, const char* description, - const std::map& valid_values, F callback) + const std::map>& valid_values, F callback) { bind_flag(value, name, description, valid_values, std::move(callback)); alias(name, aliases); @@ -191,7 +191,7 @@ bind_flag(std::string& value, const char* name, std::initializer_list bool template -typename std::enable_if()(std::declval()))>::value, void>::type +typename std::enable_if_t()(std::declval()))>::value, void> bind_flag(T& value, const char* name, const char* description, F callback) { declare_flag(name, description, value, std::function([&value, callback](const T& val) { @@ -252,16 +252,17 @@ public: * and producing an informative error message when an invalid value is passed, or when help is passed as a value. */ template - Flag(const char* name, const char* desc, T value, const std::map& valid_values, F callback) + Flag(const char* name, const char* desc, T value, const std::map>& valid_values, + F callback) : value_(value), name_(name) { - simgrid::config::bind_flag(value_, name, desc, std::move(valid_values), std::move(callback)); + simgrid::config::bind_flag(value_, name, desc, valid_values, std::move(callback)); } /* A constructor with everything */ template Flag(const char* name, std::initializer_list aliases, const char* desc, T value, - const std::map& valid_values, F callback) + const std::map>& valid_values, F callback) : value_(value), name_(name) { simgrid::config::bind_flag(value_, name, aliases, desc, valid_values, std::move(callback));