{"id":23459579,"url":"https://github.com/d-led/selfdestructing","last_synced_at":"2025-04-11T21:37:53.244Z","repository":{"id":7610989,"uuid":"8969232","full_name":"d-led/selfdestructing","owner":"d-led","description":"c++ classes crashing according to a chosen policy","archived":false,"fork":false,"pushed_at":"2025-03-22T11:49:33.000Z","size":448,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-22T12:26:55.648Z","etag":null,"topics":[],"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/d-led.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":"2013-03-23T11:22:05.000Z","updated_at":"2025-03-22T11:49:37.000Z","dependencies_parsed_at":"2022-07-31T15:08:54.133Z","dependency_job_id":null,"html_url":"https://github.com/d-led/selfdestructing","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/d-led%2Fselfdestructing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d-led%2Fselfdestructing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d-led%2Fselfdestructing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d-led%2Fselfdestructing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/d-led","download_url":"https://codeload.github.com/d-led/selfdestructing/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248484942,"owners_count":21111751,"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":[],"created_at":"2024-12-24T06:15:43.980Z","updated_at":"2025-04-11T21:37:53.195Z","avatar_url":"https://github.com/d-led.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"selfdestructing-cpp\r\n===================\r\n\r\nThis is a small C++ \"artwork\" - classes that deliberately crash on object construction.\r\n\r\nThe goal is to create a policy DSL that is readable in English. The project is a work in progress, since there are lots of possibilites of use and configuration of such classes, considering the richness of the recent C++ standard.\r\n\r\nUse?\r\n----\r\n\r\nA the primary use is (self-)education. Other uses may include debugging legacy code, class policy enforcement, and perhaps something else I cannot think of.\r\n\r\nTest: see selfdestructing.cpp\r\n\r\n````cpp\r\nstruct TestNumberCrash : public crashes::on\u003c3\u003e::copies {};\r\n````\r\n![on 3 copies](/doc/img/on_copies.png)\r\n- crashes on 3 total copies of the originally created object\r\n- doesn't crash on 3 total instances of the class\r\n\r\n---\r\n\r\n\r\n````cpp\r\nstruct TestCopyNrCrash : public crashes::after\u003c3\u003e::copies {};\r\n````\r\n![after 3 copies](/doc/img/after_copies.png)\r\n- crashes on any 3rd copy of the original object\r\n- doesn't crash on 3 total instances of the class \r\n\r\n---\r\n\r\n````cpp\r\nstruct TestTotalNrCrash : public crashes::on_total\u003c3,TestTotalNrCrash\u003e::instances {};\r\n````\r\n![on total 3 instances](/doc/img/on_total_instances.png)\r\n- crashes on instantiation of an object if 2 objects are alive\r\n- doesn't crash on any creation if the total amount of instances is below 2\r\n\r\n---\r\n\r\n````cpp\r\nstruct TestAfterTotalNrCrash : public crashes::after_total\u003c3,TestAfterTotalNrCrash\u003e::instances {};\r\n````\r\n![after total 3 instances](/doc/img/after_total_instances.png)\r\n- crashes after a third object instantiation of the class\r\n\r\n---\r\n\r\nSingular form aliases are also available, i.e. `crashes::on\u003c1\u003e::copy`.\r\n\r\nThere's no thread-safe policy yet.\r\n\r\nLicense\r\n=======\r\nAuthor: Dmitry Ledentsov\r\n\r\nMIT License (http://www.opensource.org/licenses/mit-license.php)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd-led%2Fselfdestructing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fd-led%2Fselfdestructing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd-led%2Fselfdestructing/lists"}