{"id":18842924,"url":"https://github.com/m-fatah/reflect","last_synced_at":"2026-03-04T14:02:11.005Z","repository":{"id":143453063,"uuid":"615053460","full_name":"M-Fatah/reflect","owner":"M-Fatah","description":"A single file header only static reflection library for C++20.","archived":false,"fork":false,"pushed_at":"2023-03-30T00:12:39.000Z","size":26,"stargazers_count":15,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-14T07:47:16.127Z","etag":null,"topics":["cplusplus","cpp","cpp20","gcc","header-only","msvc","no-dependencies","reflection","single-file","static-reflection"],"latest_commit_sha":null,"homepage":"https://m-fatah.github.io/","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/M-Fatah.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":"2023-03-16T21:23:40.000Z","updated_at":"2024-05-13T06:25:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"2a56d888-24c9-4be2-a9be-528163b11a43","html_url":"https://github.com/M-Fatah/reflect","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/M-Fatah/reflect","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/M-Fatah%2Freflect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/M-Fatah%2Freflect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/M-Fatah%2Freflect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/M-Fatah%2Freflect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/M-Fatah","download_url":"https://codeload.github.com/M-Fatah/reflect/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/M-Fatah%2Freflect/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30083004,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T13:22:36.021Z","status":"ssl_error","status_checked_at":"2026-03-04T13:20:45.750Z","response_time":59,"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":["cplusplus","cpp","cpp20","gcc","header-only","msvc","no-dependencies","reflection","single-file","static-reflection"],"created_at":"2024-11-08T02:56:04.269Z","updated_at":"2026-03-04T14:02:10.997Z","avatar_url":"https://github.com/M-Fatah.png","language":"C++","readme":"\u003c!-- badges: start --\u003e\n[![Build status](https://github.com/M-Fatah/reflect/workflows/CI/badge.svg)](https://github.com/M-Fatah/reflect/actions?workflow=CI)\n\u003c!-- badges: end --\u003e\n---\n\n## **Introduction:**\nReflect is single file header only library that provides static reflection for C++.\n\n## **API:**\nPrimitive types, pointers, arrays and enums are supported out of the box.\nHowever automatic generation of reflection info for enums is limited to values between `REFLECT_MIN_ENUM_VALUE` to `REFLECT_MAX_ENUM_VALUE`.\n\n```C++\nstruct Vector3\n{\n    f32 x, y, z;\n};\n\nTYPE_OF(Vector3, x, y, z)\n\ntemplate \u003ctypename T\u003e\nstruct Foo\n{\n    T t;\n};\n\ntemplate \u003ctypename T\u003e\nTYPE_OF(Foo\u003cT\u003e, t)\n\ntemplate \u003ctypename T, typename R\u003e\nstruct Bar\n{\n    Foo\u003cT\u003e foo;\n    R r;\n};\n\ntemplate \u003ctypename T, typename R\u003e\nTYPE_OF((Bar\u003cT, R\u003e), foo, r)\n\nstruct Serializable\n{\n    char a;\n    bool b;\n    f32 *c;\n    const char *d;\n    void *e;\n};\n\n// You can annotate fields with custom annotations that will be stored statically with the type info.\nTYPE_OF(Serializable, a, b, c, d, (e, \"NoSerialize\"))\n------------------------------------------------------------------------------\nenum Enum\n{\n    A = -3,\n    B = 8,\n    c = 7\n};\n\n// You can use `type_of\u003cT\u003e();` directly without using `TYPE_OF_ENUM(T, ...)` macro, but it will return type info along enum values in this order {{\"A\", -3}, {\"C\", 7}, {\"B\", 8}}, and will be limited to the range between `REFLECT_MIN_ENUM_VALUE` to `REFLECT_MAX_ENUM_VALUE`.\nauto enum_type = type_of\u003cEnum\u003e();\n\n// However, if `TYPE_OF_ENUM` macro is used, the correct order of definition will be returned.\n// {{\"A\", -3}, {\"B\", 8}, {\"C\", 7}}\n// And it can work on any enum range.\nTYPE_OF_ENUM(Enum, A, B, C)\n------------------------------------------------------------------------------\nauto t = type_of\u003cT\u003e();\nauto t = type_of(T{});\nauto n = name_of\u003cT\u003e();\nauto k = kind_of\u003cT\u003e();\nauto v = value_of(T{});\n```\n\n## **Compilers:**\n- MSVC: `-std:c++20 -Zc:preprocessor`.\n- GCC: `-std=c++2b`.\n- Clang (later).\n\n## **Building:**\n- Use one of the scripts to build examples and unittest.\n- Output is in `build/bin/${CONFIG}/` directory.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm-fatah%2Freflect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fm-fatah%2Freflect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm-fatah%2Freflect/lists"}