{"id":18440481,"url":"https://github.com/lackhole/lupin","last_synced_at":"2026-03-17T21:04:59.521Z","repository":{"id":116951039,"uuid":"361115281","full_name":"lackhole/lupin","owner":"lackhole","description":"Access member fields ignoring access specifiers","archived":false,"fork":false,"pushed_at":"2021-07-02T06:52:06.000Z","size":25,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-07T21:41:55.865Z","etag":null,"topics":["access","access-specifiers","cpp"],"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/lackhole.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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-04-24T08:56:35.000Z","updated_at":"2025-02-28T17:58:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"aab6c1d3-eef9-49ca-bf70-f4e7d738ddee","html_url":"https://github.com/lackhole/lupin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lackhole/lupin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lackhole%2Flupin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lackhole%2Flupin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lackhole%2Flupin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lackhole%2Flupin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lackhole","download_url":"https://codeload.github.com/lackhole/lupin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lackhole%2Flupin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30631437,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-17T17:32:55.572Z","status":"ssl_error","status_checked_at":"2026-03-17T17:32:38.732Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["access","access-specifiers","cpp"],"created_at":"2024-11-06T06:30:28.938Z","updated_at":"2026-03-17T21:04:59.517Z","avatar_url":"https://github.com/lackhole.png","language":"C++","readme":"# Access\n#### A generic library for accessing class members, ignoring their access specifiers.  \n\n* No need to modify the target class\n* No need to overwrite access specifiers with macros\n* Not using dirty pointer-offset, making it more flexible on changes.\n\n\u003cbr/\u003e\n\n* Header-only\n* Compile-time traits, zero runtime overhead.\n* Only requires the name of the class and member(member type **NOT** required!)\n* Can be useful when testing private/protected members or functions.\n\n## Requirements\n### C++ Version\n* C++14 or higher\n### Compiler Support\n\n| Compiler | Minimum version |\n|----------|-----------------|\n| gcc      |       6.0       |\n| clang    |       8.0       |\n| MSVC     |19.14(below not tested)|\n\n## Limitations\n* Does not work on template type members.\n* Does not work on overloaded functions.\n\n## Examples\nWhole example can be found [here](main.cpp)\n\n### Motivating Example 1\n```c++\n#include \u003ciostream\u003e\n\n#include \"access/access.hpp\"\n\nstruct foo {\n private:\n  std::string name = \"hello\";\n  int age = 27;\n  void print() {}\n};\n\n// Tag will be used when accessing private/protected/public data.\n// One tag coresponds to one member of a class.\n// After the tag is named, it has to be enabled using access::Accessor\n\nusing tag_foo_name = access::Tag\u003cclass foo_name\u003e;\ntemplate struct access::Accessor\u003ctag_foo_name, foo, decltype(\u0026foo::name), \u0026foo::name\u003e;\n\nint main() {\n  foo f;\n  \n  // peek hidden data\n  std::cout \u003c\u003c access::get\u003ctag_foo_name\u003e(f) \u003c\u003c '\\n'; // \"hello\"\n  \n  // steal hidden data\n  access::get\u003ctag_foo_name\u003e(f) = \"lupin\";\n  std::cout \u003c\u003c access::get\u003ctag_foo_name\u003e(f) \u003c\u003c '\\n'; // \"lupin\"\n}\n```\n\n### Motivating Example 2\n```c++\n#include \u003ciostream\u003e\n\n#include \"access/access.hpp\"\n\nstruct foo {\n private:\n  std::string name = \"hello\";\n  int age = 27;\n  void print() {}\n};\n\n// simplified using macro\nACCESS_CREATE_TAG(my_tag_123, foo, age);\nACCESS_CREATE_UNIQUE_TAG(foo, age);\n\nint main() {\n  foo f;\n  \n  auto a = access::get\u003cmy_tag_123\u003e(f);                      // named tag access\n  auto b = access::get\u003cACCESS_GET_UNIQUE_TAG(foo, age)\u003e(h); // unnamed tag(unique) access\n}\n```\n\n### Motivating Example 3\n```c++\n#include \"access/access.hpp\"\n\nstruct foo {\n private:\n  std::string name = \"hello\";\n  int age = 27;\n  void print() {}\n};\n\nACCESS_CREATE_TAG(tag_foo_print, foo, print);\n\nint main() {\n  foo f;\n  \n  // call hidden function\n  access::call\u003ctag_foo_print\u003e(f);           // call directly\n  (f.*access::get\u003ctag_foo_print\u003e(f))();     // call manually after getting its pointer\n}\n```\n\n### Motivating Example 4\n```c++\n#include \"access/access.hpp\"\n\nstruct foo {\n private:\n  std::string name = \"hello\";\n  int age = 27;\n  void print() {}\n};\n\nACCESS_CREATE_TAG(tag_foo_age, foo, print);\n\nint main() {\n  foo f;\n  \n  // get type of hidden data\n  static_assert(std::is_same\u003caccess::Type_t\u003ctag_foo_age\u003e, int\u003e::value, \"\");\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flackhole%2Flupin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flackhole%2Flupin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flackhole%2Flupin/lists"}