Skip to content

add move construct for double link list#100

Merged
wokron merged 3 commits into
masterfrom
update-double-list
Apr 28, 2026
Merged

add move construct for double link list#100
wokron merged 3 commits into
masterfrom
update-double-list

Conversation

@wokron
Copy link
Copy Markdown
Member

@wokron wokron commented Apr 27, 2026

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the intrusive container utilities by adding move support for IntrusiveDoubleList, and extends the unit tests to validate basic move behavior.

Changes:

  • Add move constructor and move-assignment operator to IntrusiveDoubleList.
  • Remove debug-only ownership tracking from DoubleLinkEntry and related assertions.
  • Add a new doctest covering move-assignment of a double intrusive list.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
include/condy/intrusive.hpp Adds move operations for IntrusiveDoubleList and removes debug ownership checks from double-link entries.
tests/test_intrusive.cpp Adds a new test case for IntrusiveDoubleList move behavior.
Comments suppressed due to low confidence (1)

include/condy/intrusive.hpp:110

  • The PR removes the DoubleLinkEntry::owner debug field and the associated ownership assertions in push_back/pop_front/remove. That weakens debug-mode detection of cross-list misuse (e.g., calling remove() with an item belonging to a different list), which can silently corrupt lists. If move support is the motivation, consider keeping owner under #ifndef NDEBUG and updating it during move (O(n) but debug-only), or otherwise retaining an equivalent debug membership check.
    void push_back(T *item) noexcept {
        assert(item != nullptr);
        DoubleLinkEntry *entry = &(item->*Member);
        assert(entry->next == nullptr && entry->prev == nullptr);
        entry->next = nullptr;

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread include/condy/intrusive.hpp
Comment thread include/condy/intrusive.hpp
Comment thread tests/test_intrusive.cpp
@wokron wokron force-pushed the update-double-list branch from f1f7a8d to ca4ddca Compare April 28, 2026 02:43
@wokron wokron marked this pull request as ready for review April 28, 2026 02:48
@wokron wokron merged commit ead1e5e into master Apr 28, 2026
11 checks passed
@wokron wokron deleted the update-double-list branch April 28, 2026 02:49
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