- return std::count_if(std::begin(enabled_element_set_), std::end(enabled_element_set_),
- [](const Element& elem) { return elem.consumption_weight > 0; });
+ return static_cast<int>(std::count_if(std::begin(enabled_element_set_), std::end(enabled_element_set_),
+ [](const Element& elem) { return elem.consumption_weight > 0; }));
+}
+
+void Constraint::set_sharing_policy(SharingPolicy policy, const s4u::NonLinearResourceCb& cb)
+{
+ xbt_assert(policy == SharingPolicy::NONLINEAR || not cb,
+ "Invalid sharing policy for constraint. Callback should be used with NONLINEAR sharing policy");
+ sharing_policy_ = policy;
+ dyn_constraint_cb_ = cb;