Skip to content

Conversation

@mohameds-dev
Copy link
Owner

Release the move_to_front feature

  • Release the central feature move_to_front which allows for reordering OrderedMap entries in constant time O(1).
  • Modify the DoublyLinkedList and OrderedMap internals to adhere to move and copy semantics and avoid unnecessary or unexpected moving / copying of objects.
  • Overload constructors to allow for using initializer list and other STL-style iterators to initialize both DoublyLinkedList and OrderedMap.

- Move the MoveCopyFlag class to a separate file to import in different test files (DRY)
- Create tests for moving objects in push_front
- Overload push_front to support moving
- Constructor with initalizer list
- Constructor with begin and end iterators
- Create helper function extract_node_and_link_prev_with_next to extract node without affecting value or iterator
- Create helper function emplace_node_before to insert node at any desired position without affecting value or iterator
- Modify pop_back(), pop_front() and erase_middle_node() to move the values insead of copying them
- Define (=) operator for the MoveCopyFlag to fix the deleted operator error
- Overload insert to support moving without copying
- Use emplace_back instead of push_back to avoid unnecessary moves or copies
- Use move_to_begin list function instead of push_front with erase
@mohameds-dev mohameds-dev merged commit 3de031e into main May 24, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants