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

iterator operators not returning iterator reference #8

Closed dinghram closed 6 years ago

dinghram commented 6 years ago

For parity with std::list, (at least in Visual Studio), the following should return a reference to the list_iterator, rather than a copy:

inline PLF_LIST_FORCE_INLINE list_iterator operator ++ () PLF_LIST_NOEXCEPT inline PLF_LIST_FORCE_INLINE list_iterator operator -- () PLF_LIST_NOEXCEPT inline list_iterator operator = (const list_iterator &rh) PLF_LIST_NOEXCEPT inline list_iterator operator = (const list_iterator &&rh) PLF_LIST_NOEXCEPT

inline PLF_LIST_FORCE_INLINE list_reverse_iterator operator ++ () PLF_LIST_NOEXCEPT inline PLF_LIST_FORCE_INLINE list_reverse_iterator operator -- () PLF_LIST_NOEXCEPT inline list_reverse_iterator operator = (const list_reverse_iterator &rh) PLF_LIST_NOEXCEPT inline list_reverse_iterator operator = (const list_reverse_iterator &&rh) PLF_LIST_NOEXCEPT

mattreecebentley commented 6 years ago

Thanks the original reason I didn't do this was because I figured since the iterator is just a pointer anyway, returning a pointer to a pointer (reference) would incur a performance cost - having done some benchmarking this is not the case, and you're correct that this is a standards compliance "thing". https://en.cppreference.com/w/cpp/language/operator_incdec

mattreecebentley commented 6 years ago

Fixed

dinghram commented 6 years ago

Thanks

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

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/8#issuecomment-398996138, or mute the thread https://github.com/notifications/unsubscribe-auth/AWCfOTQQe9sti_Me6rLLBe_H7JzDtKWKks5t-0NNgaJpZM4UwBMN .