From: Arnaud Giersch Date: Mon, 4 Dec 2017 20:39:38 +0000 (+0100) Subject: Define simgrid::xbt::intrusive_erase to remove an element from a boost::instrusive... X-Git-Tag: v3.18~162 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/10728a913d95590a3d5f162ce6016ca3e3cd4e92?hp=6315d266b5084c6e28c38f1daf4f0b3cb72608e6 Define simgrid::xbt::intrusive_erase to remove an element from a boost::instrusive::list. --- diff --git a/include/xbt/utility.hpp b/include/xbt/utility.hpp index e5776312f2..c2315dbbf4 100644 --- a/include/xbt/utility.hpp +++ b/include/xbt/utility.hpp @@ -22,6 +22,13 @@ public: bool operator()(const Pair& a, const Pair& b) const { return a.first > b.first; } }; +/** @brief Erase an element given by reference from a boost::intrusive::list. + */ +template inline void intrusive_erase(List& list, Elem& elem) +{ + list.erase(list.iterator_to(elem)); +} + // integer_sequence and friends from C++14 // We need them to implement `apply` from C++17.