mattreecebentley / plf_list

A drop-in replacement for std::list with 293% faster insertion, 57% faster erasure, 17% faster iteration and 77% faster sorting on average. 20-24% speed increase in use-case testing.
https://plflib.org/list.htm
zlib License
151 stars 21 forks source link

plf_list.remove() leaves an element stuck in the list #1

Closed jdmairs closed 6 years ago

jdmairs commented 6 years ago

Add the following test to plf_list_test_suite.cpp (remove ( ==5))

list1.remove(4) failpass("should be empty list", 0 == list1.size())

Also replicated by: plf::list<int*> x; int a; int b; x.push_back(&a); x.push_back(&b); x.remove(&a); x.remove(&b); failpass("should be empty" 0 == x.size())

Love the list, we are seeing a 16% increase in performance. Luckily our own unittest alerted us to this problem.

mattreecebentley commented 6 years ago

Thanks! Always good to hear people finding it useful :) Will look into it

mattreecebentley commented 6 years ago

Wow - this was non-trivial. Same edge-case also affected a bunch of other functions - thanks