
Hi, I have two slists and transfer items between them via splice() methods. Without cache_last everything works as expected. With cache_last the third call to splice does not transfer the list element. Am I using something wrong or is this a bug in intrusive? Thanks, Christian #include <boost/intrusive/slist.hpp> #include <boost/intrusive/slist_hook.hpp> #include <cassert> using namespace boost::intrusive; class MyClass : public slist_base_hook<> { int int_; public: MyClass(int i) : int_(i) {} }; typedef slist<MyClass, cache_last<true> > MyList; int main () { MyList freeList; for (int j = 0; j < 5; ++j) { freeList.push_front (*(new MyClass (j))); } MyList listInUse; // transfer first element of freeList to listInUse size_t free = freeList.size (); size_t inUse = listInUse.size (); listInUse.splice (listInUse.begin (), freeList, freeList.begin ()); assert (freeList.size () == free - 1); assert (listInUse.size () == inUse + 1); // transfer all elements of listInuse to freeList free = freeList.size (); inUse = listInUse.size (); freeList.splice (freeList.begin (), listInUse); assert (listInUse.empty ()); assert (freeList.size () == free + inUse); // again, transfer first element of freeList to listInUse free = freeList.size (); inUse = listInUse.size (); listInUse.splice (listInUse.begin (), freeList, freeList.begin ()); assert (freeList.size () == free - 1); // fails, sizes are 5 and 0 assert (listInUse.size () == inUse + 1); // release memory omitted return 0; }