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

Cannot use non-const functors for sort #10

Closed dinghram closed 6 years ago

dinghram commented 6 years ago

With std::list, I can use a functor with a non-const operator() when sorting. This can be helpful when the compare has to build some temporary data per item (like a display name), caching the value internally so that it doesn't have to build the display name every time that record is compared during the sort.

This can be fixed by adding a second, non-const operator() in sort_dereferencer with the same code as the const version. I am not sure this works on all compilers/platforms.

mattreecebentley commented 6 years ago

Good point - fixed.

dinghram commented 6 years ago

Thanks

On Thu, Jun 21, 2018 at 12:55 AM mattreecebentley notifications@github.com wrote:

Good point - fixed.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mattreecebentley/plf_list/issues/10#issuecomment-398996173, or mute the thread https://github.com/notifications/unsubscribe-auth/AWCfOcneYetwqS1FuPCmKWrZmG9XM_xFks5t-0NXgaJpZM4UwCS7 .