+ simgrid::config::bind_flag(value_, name, aliases, desc);
+ }
+
+ /* A constructor accepting a callback that will be passed the parameter.
+ * It can either return a boolean (informing whether the parameter is valid), or returning void.
+ */
+ template <class F>
+ Flag(const char* name, const char* desc, xbt::type_identity_t<T> value, F callback) : value_(value), name_(name)
+ {
+ simgrid::config::bind_flag(value_, name, desc, std::move(callback));
+ }
+
+ template <class F>
+ Flag(const char* name, std::initializer_list<const char*> aliases, const char* desc, xbt::type_identity_t<T> value,
+ F callback)
+ : value_(value), name_(name)
+ {
+ simgrid::config::bind_flag(value_, name, aliases, desc, std::move(callback));
+ }
+
+ /* A constructor accepting a map of valid values -> their description,
+ * and producing an informative error message when an invalid value is passed, or when help is passed as a value.
+ */
+ Flag(const char* name, const char* desc, xbt::type_identity_t<T> value,
+ const std::map<std::string, std::string, std::less<>>& valid_values)
+ : value_(value), name_(name)
+ {
+ simgrid::config::bind_flag(value_, name, desc, valid_values, [](const std::string&) {});
+ }
+
+ /* As earlier, a constructor accepting a map of valid values -> their description,
+ * and producing an informative error message when an invalid value is passed, or when help is passed as a value.
+ * But also take a callback that is invoked before the verification of parameter name validity.
+ */
+ template <class F>
+ Flag(const char* name, const char* desc, xbt::type_identity_t<T> value,
+ const std::map<std::string, std::string, std::less<>>& valid_values, F callback)
+ : value_(value), name_(name)
+ {
+ simgrid::config::bind_flag(value_, name, desc, valid_values, std::move(callback));
+ }
+
+ /* A constructor with everything */
+ template <class F>
+ Flag(const char* name, std::initializer_list<const char*> aliases, const char* desc, xbt::type_identity_t<T> value,
+ const std::map<std::string, std::string, std::less<>>& valid_values, F callback)
+ : value_(value), name_(name)
+ {
+ simgrid::config::bind_flag(value_, name, aliases, desc, valid_values, std::move(callback));