{"id":18404557,"url":"https://github.com/avakar/intrusive_list","last_synced_at":"2025-04-12T19:57:46.968Z","repository":{"id":137929429,"uuid":"413830755","full_name":"avakar/intrusive_list","owner":"avakar","description":"Header-only, composition-based, allocation-free double-linked list for C++11","archived":false,"fork":false,"pushed_at":"2021-10-05T15:47:06.000Z","size":8,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-12T19:57:43.945Z","etag":null,"topics":["cpp","cpp11","intrusive-containers","linked-list"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"0bsd","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/avakar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-05T13:31:48.000Z","updated_at":"2024-10-24T09:06:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"efd822b2-1186-4c77-93e9-9dbd4e341bd2","html_url":"https://github.com/avakar/intrusive_list","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avakar%2Fintrusive_list","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avakar%2Fintrusive_list/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avakar%2Fintrusive_list/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avakar%2Fintrusive_list/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/avakar","download_url":"https://codeload.github.com/avakar/intrusive_list/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248625510,"owners_count":21135513,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","cpp11","intrusive-containers","linked-list"],"created_at":"2024-11-06T02:53:14.222Z","updated_at":"2025-04-12T19:57:46.945Z","avatar_url":"https://github.com/avakar.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# intrusive_list\n\nHeader-only, composition-based, allocation-free double-linked list for C++11.\n\n## Getting started\n\nAdd `list_node` as a member to whatever struct you want to keep a list of.\nThen, you can insert _references_ to that struct into a list.\n\n```cpp\n#include \u003cavakar/intrusive/list.h\u003e\nusing namespace avakar::intrusive;\n\nstruct X {\n    // A node maintains a membership in at most one list.\n    list_node load_order;\n\n    // If your object is kept in multiple lists, you need a node for each list.\n    list_node memory_order;\n};\n\nint main()\n{\n    // Lists are ranges of references. You must specify the node to be used\n    // by each list.\n    list\u003cX, \u0026X::load_order\u003e load_order_list;\n\n    load_order_list.push_back(x);\n\n    // You can check if a node is attached to a list.\n    assert(x.load_order.attached());\n    assert(!x.memory_order.attached());\n\n    // You can enumerate elements the way you would any other range.\n    for (X \u0026 elem: load_order_list) {\n        // ...\n    }\n\n    list\u003cX, \u0026X::load_order\u003e another_load_order_list;\n\n    // Inserting to another list that uses the same node will detach that\n    // node from any list it is currently attached in.\n    another_load_order_list.push_back(x);\n    assert(load_order_list.empty());\n\n    // You can erase an element with `erase`, but if you have the associated\n    // node available, you can use `detach` on the node.\n    x.load_order.detach();\n    assert(another_load_order_list.empty());\n}\n```\n\nNodes are movable and will carry the list membership with them.\nNode objects that were moved from will end up detached.\n\nClearing or destroying a list will detach all its nodes.\n\n## Thread-safety\n\nThere is none.\n\n## CMake integration\n\nCopy this repo into yours, add it as a submodule, or `FetchContent` it.\nEither way, make sure this repo is added via `add_subdirectory` or\n`FetchContent_MakeAvailable`, then link against `avakar::intrusive_list`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favakar%2Fintrusive_list","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Favakar%2Fintrusive_list","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favakar%2Fintrusive_list/lists"}