Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Define simgrid::xbt::intrusive_erase to remove an element from a boost::instrusive...
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 4 Dec 2017 20:39:38 +0000 (21:39 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 4 Dec 2017 22:41:13 +0000 (23:41 +0100)
include/xbt/utility.hpp

index e577631..c2315db 100644 (file)
@@ -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 <class List, class Elem> 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.