{"id":17143290,"url":"https://github.com/meircif/lumi-safe-ptr","last_synced_at":"2025-03-24T09:25:37.419Z","repository":{"id":184224213,"uuid":"670048827","full_name":"meircif/lumi-safe-ptr","owner":"meircif","description":"Safe wrapper of C++ smart pointers","archived":false,"fork":false,"pushed_at":"2023-08-01T15:07:07.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-29T14:53:49.123Z","etag":null,"topics":["cplusplus","cplusplus-11","hacktoberfest","header-only","smart-pointers"],"latest_commit_sha":null,"homepage":"","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/meircif.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","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":"2023-07-24T07:22:01.000Z","updated_at":"2023-09-30T18:13:06.000Z","dependencies_parsed_at":"2024-12-03T20:16:00.737Z","dependency_job_id":null,"html_url":"https://github.com/meircif/lumi-safe-ptr","commit_stats":null,"previous_names":["meircif/lumi-safe-ptr"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meircif%2Flumi-safe-ptr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meircif%2Flumi-safe-ptr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meircif%2Flumi-safe-ptr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meircif%2Flumi-safe-ptr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/meircif","download_url":"https://codeload.github.com/meircif/lumi-safe-ptr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245241717,"owners_count":20583305,"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":["cplusplus","cplusplus-11","hacktoberfest","header-only","smart-pointers"],"created_at":"2024-10-14T20:34:09.318Z","updated_at":"2025-03-24T09:25:37.391Z","avatar_url":"https://github.com/meircif.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![CI Status](https://github.com/meircif/lumi-safe-ptr/workflows/CI/badge.svg\n  )](https://github.com/meircif/lumi-safe-ptr/actions)\n\n# Safe C++ Smart Pointers Wrapper\n\nThe \"Lumi\" project goal is to provide tools for writing safe and efficient code.\nThis `lumi-safe-ptr` library provides C++ smart pointers wrappers that makes\nthem even more safe to use.\n\nWhile C++ smart pointers help a lot in writing memory safe code - they still\nhave some pitfalls and problems that users can mistakenly fall into. These are\nthe issues that `lumi-safe-ptr` library solves:\n\n  * The infamous [`shared_ptr` circular reference issue](\n    #avoid-shared_ptr-circular-references)\n  * More [planned in the future...](#future-work)\n\n## Installation and Usage\n\nThis is a header-only library with a single header file located in\n[include/lumi-safe-ptr.hpp](include/lumi-safe-ptr.hpp).\nThis file can be simply downloaded and included by\n`#include \"lumi-safe-ptr.hpp\"`. All macros start with `LUMI_` prefix and all\nother symbols are inside `lumi::` namespace.\n\n## Avoid shared_ptr circular references\n\nThis is the most known `shared_ptr` issue that is now avoidable 😃.\n\nIt can be solved using macros `LUMI_CYCLE_CHECK` and `LUMI_STRONG_PTR` that will\nraise a compilation error when a circular reference is detected. Their usage is\nsimple:\n\n1. Every `shared_ptr` member in a type should be declared using\n   `LUMI_STRONG_PTR(type) name;` (instead of `std::shared_ptr\u003ctype\u003e name;`).\n2. Before Every type that uses `LUMI_STRONG_PTR` add (in the global scope)\n   `LUMI_CYCLE_CHECK(type, pointed_types...)`\n\nFor example:\n```c++\n#include \"lumi-safe-ptr.hpp\"\n\nLUMI_CYCLE_CHECK(module::A, module::B, module::C)\n\nnamespace module {\n\nclass A {\n    LUMI_STRONG_PTR(B) b;\n    LUMI_STRONG_PTR(C) c;\n};\n\n}\n```\n\n## Future Work\n\nMore Issues that may be solved next as long as they can be technically done\nusing C++ syntax:\n\n1. Access moved `unique_ptr`\n2. Using unchecked `weak_ptr`\n3. Deleting the raw pointers\n4. Thread safety\n5. Using non-heap pointers\n6. Not using `make_shared`\n7. Safe arrays of pointers\n8. Derived to base class pointer\n9. Garbage collecting pointer\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeircif%2Flumi-safe-ptr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmeircif%2Flumi-safe-ptr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeircif%2Flumi-safe-ptr/lists"}