{"id":23564099,"url":"https://github.com/curve/eraser","last_synced_at":"2025-09-08T15:46:39.724Z","repository":{"id":269756939,"uuid":"908371003","full_name":"Curve/eraser","owner":"Curve","description":"✏️ A C++20 type-erasure library","archived":false,"fork":false,"pushed_at":"2024-12-29T19:09:15.000Z","size":56,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-08T18:50:07.607Z","etag":null,"topics":["cpp","cpp-library","cpp20","cpp20-library","polymorphism","type-erasure"],"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/Curve.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,"zenodo":null}},"created_at":"2024-12-25T22:28:56.000Z","updated_at":"2025-03-05T21:58:01.000Z","dependencies_parsed_at":"2025-05-16T04:31:10.856Z","dependency_job_id":null,"html_url":"https://github.com/Curve/eraser","commit_stats":null,"previous_names":["curve/eraser"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Curve%2Feraser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Curve%2Feraser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Curve%2Feraser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Curve%2Feraser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Curve","download_url":"https://codeload.github.com/Curve/eraser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254468995,"owners_count":22076405,"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","cpp-library","cpp20","cpp20-library","polymorphism","type-erasure"],"created_at":"2024-12-26T17:12:46.768Z","updated_at":"2025-05-16T04:31:49.701Z","avatar_url":"https://github.com/Curve.png","language":"C++","readme":"\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"assets/logo.svg\" height=\"312\"\u003e\n\u003c/div\u003e\n\n\u003cbr/\u003e\n\n\u003cp align=\"center\"\u003e\n    A C++20 type-erasure library that supports interfaces\n\u003c/p\u003e\n\n\u003chr/\u003e\n\n## 👋 Introduction\n\n_Eraser_ is an easy, customizable, C++20 type-erasure library that supports user defined interfaces.   \n\n## 📦 Installation\n\n* Using [CPM](https://github.com/cpm-cmake/CPM.cmake)\n  ```cmake\n  CPMFindPackage(\n    NAME           eraser\n    VERSION        2.2.1\n    GIT_REPOSITORY \"https://github.com/Curve/eraser\"\n  )\n  ```\n\n* Using FetchContent\n  ```cmake\n  include(FetchContent)\n\n  FetchContent_Declare(eraser GIT_REPOSITORY \"https://github.com/Curve/eraser\" GIT_TAG v2.2.1)\n  FetchContent_MakeAvailable(eraser)\n\n  target_link_libraries(\u003ctarget\u003e cr::eraser)\n  ```\n\n## \n\n## 📖 Examples\n\nGiven two classes `erase_me` and `erase_me_too`:\n\nhttps://github.com/Curve/eraser/blob/b61dc0f00541ad2ffd37e83c69b6e5d1e0b726b4/tests/classes.hpp#L5-L37\n\nThere are two ways to \"erase\" them:\n\n...the normal approach:\n\nhttps://github.com/Curve/eraser/blob/b61dc0f00541ad2ffd37e83c69b6e5d1e0b726b4/tests/erased.cpp#L13-L22\nhttps://github.com/Curve/eraser/blob/b61dc0f00541ad2ffd37e83c69b6e5d1e0b726b4/tests/erased.cpp#L27-L36\n\n... or the experimental/\"hacky\" approach:\n\nhttps://github.com/Curve/eraser/blob/b61dc0f00541ad2ffd37e83c69b6e5d1e0b726b4/tests/deduce.cpp#L9-L20\nhttps://github.com/Curve/eraser/blob/b61dc0f00541ad2ffd37e83c69b6e5d1e0b726b4/tests/deduce.cpp#L29-L38\n\n---\n\nWhile the \"hacky\" approach might look more pleasing, you should prefer to use the normal approach.\nAs the name implies, the hacky approach relies on friend injection which allows one to do stateful meta-programming, which is _technically_ not _legal_ C++, however, all three major compilers support it.\n\n## ⭐ Credits \n\n- [[boost-ext/te]](https://github.com/boost-ext/te): Inspiration for the `experimental` interface.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcurve%2Feraser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcurve%2Feraser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcurve%2Feraser/lists"}