{"id":20250240,"url":"https://github.com/pavelkryukov/forward_list2","last_synced_at":"2025-03-03T16:23:10.777Z","repository":{"id":37038833,"uuid":"437111959","full_name":"pavelkryukov/forward_list2","owner":"pavelkryukov","description":"C++ std::forward_list with push_back and before_end","archived":false,"fork":false,"pushed_at":"2022-06-18T11:52:44.000Z","size":135,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-14T02:43:17.110Z","etag":null,"topics":["boost","cpp23","cpp26","forward-list","linked-list","linked-list-in-cpp","linked-lists","stl","stl-containers"],"latest_commit_sha":null,"homepage":"https://pavelkryukov.github.io/forward_list2/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pavelkryukov.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}},"created_at":"2021-12-10T20:56:50.000Z","updated_at":"2022-01-06T19:49:51.000Z","dependencies_parsed_at":"2022-08-17T23:40:47.523Z","dependency_job_id":null,"html_url":"https://github.com/pavelkryukov/forward_list2","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/pavelkryukov%2Fforward_list2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pavelkryukov%2Fforward_list2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pavelkryukov%2Fforward_list2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pavelkryukov%2Fforward_list2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pavelkryukov","download_url":"https://codeload.github.com/pavelkryukov/forward_list2/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241696740,"owners_count":20004881,"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":["boost","cpp23","cpp26","forward-list","linked-list","linked-list-in-cpp","linked-lists","stl","stl-containers"],"created_at":"2024-11-14T09:57:34.583Z","updated_at":"2025-03-03T16:23:10.754Z","avatar_url":"https://github.com/pavelkryukov.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![codecov](https://codecov.io/gh/pavelkryukov/forward_list2/branch/main/graph/badge.svg?token=5KtoC3WASR)](https://codecov.io/gh/pavelkryukov/forward_list2)\n\n# forward_list2\n\nWrapper around C++ [`std::forward_list`](https://en.cppreference.com/w/cpp/container/forward_list) which adds an iterator to the last element.\n\nThe idea has been proposed and discussed here: [cpp-ru/ideas#487](https://github.com/cpp-ru/ideas/issues/487).\n\n\n### Extra functions\n```c++\nconst_reference back() const;\n\nconst_iterator before_end() const noexcept;\nconst_iterator cbefore_end() const noexcept;\n\nvoid push_back(const T\u0026 value);\nvoid push_back(T\u0026\u0026 value);\n\ntemplate\u003cclass... Args\u003e\nreference emplace_back(Args\u0026\u0026... args);\n```\n\n### Price\n* Compute time overheads to maintain the iterator to the last element.\n* Extra O(N) traversals on copy assignment and sorting.\n* Memory size overhead on empty container:\n```c++\nstatic_assert(sizeof(std::forward_list\u003cint\u003e) == sizeof(void*));\nstatic_assert(sizeof(forward_list2\u003cint\u003e) == 2 * sizeof(void*));\n```\n\n### Limitations\n\n* No `reference back();` is available since it would require passing non-constant iterator to `erase_after`.\n\n### Impact\n\n* Identified and fixed [PR libstdc++/103853](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103853).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpavelkryukov%2Fforward_list2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpavelkryukov%2Fforward_list2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpavelkryukov%2Fforward_list2/lists"}