-
Notifications
You must be signed in to change notification settings - Fork 86
Description
I understand the reason why m-list grows "from the back" and therefore iterates from the back to the front as the structure holds a reference to the last item pushed, but I feel like this becomes a bit confusing when applied to a dual push list.
With a dual push m-list, _push()
and _push_back()
add to the back, while iterating is also done from the back. _push_front()
adds to the front, which is the last item to get iterated over. From what I could tell, there is no other way of addressing the list other than iterating, so whether it is "from the back" or "from the front" is just semantics, and indexes are not a concern of m-list from what I can see.
So I believe that when using a dual push m-list's _push_back()
and the newly added item is the first to be iterated over, to the user this seems confusing and just backwards of the expected behavior.
I wanted to ask if adding an option, whether as an optional argument to LIST_DUAL_PUSH_DEF()
or as a new type like LIST_DUAL_PUSH_REVERSE_DEF()
(not ideal, first name that came to mind, suggestions welcome), that essentially just swaps the behavior of _push()
/_push_back()
with _push_front()
, would be a possibility and/or it would be a welcome addition to upstream M*LIB.
I would be open to try implementing it myself, though I am not super familiar with M*LIB's internals so I could use a few pointers and general ideas of where to start implementing such an option, unless it is indeed a welcome idea and you'd prefer to implement it yourself of course.
Also, thank you for this awesome library!