{"id":20606024,"url":"https://github.com/martinitus/fmt-reflect","last_synced_at":"2025-08-22T10:10:00.383Z","repository":{"id":84288309,"uuid":"276142325","full_name":"martinitus/fmt-reflect","owner":"martinitus","description":"Simple reflection experiments with libfmt and C++20","archived":false,"fork":false,"pushed_at":"2020-07-01T15:22:01.000Z","size":5,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-06T17:16:07.714Z","etag":null,"topics":["libfmt","reflection"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/martinitus.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2020-06-30T15:43:00.000Z","updated_at":"2021-08-24T16:03:59.000Z","dependencies_parsed_at":"2023-04-27T19:07:18.853Z","dependency_job_id":null,"html_url":"https://github.com/martinitus/fmt-reflect","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/martinitus/fmt-reflect","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinitus%2Ffmt-reflect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinitus%2Ffmt-reflect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinitus%2Ffmt-reflect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinitus%2Ffmt-reflect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/martinitus","download_url":"https://codeload.github.com/martinitus/fmt-reflect/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinitus%2Ffmt-reflect/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271620597,"owners_count":24791569,"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","status":"online","status_checked_at":"2025-08-22T02:00:08.480Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["libfmt","reflection"],"created_at":"2024-11-16T09:32:07.850Z","updated_at":"2025-08-22T10:10:00.340Z","avatar_url":"https://github.com/martinitus.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Formatting user objects with `libfmt`\n\nThis repo shows an example how to use [libfmt](https://github.com/fmtlib/fmt) and _manually configured static reflection_ to format user defined \nstructures.\n\nEssentially it provides template specializations for `fmt::formatter` that allow formatting of structs for which \nreflection information was setup via the `reflection` template.\n\nThanks to [this blog](https://wgml.pl/blog/formatting-user-defined-types-fmt.html) which helped a lot :-) \n\nExample: \n\n```c++\n\nstruct Inner {...};\nstruct Outer {...};\n\ntemplate\u003c\u003e\nstruct reflection\u003cOuter\u003e {\n    /*definition of class name and field names has to provided manually...*/\n};\n\ntemplate\u003c\u003e\nstruct reflection\u003cInner\u003e {\n    /*definition of class name and field names has to provided manually...*/\n};\n\nauto outer = Outer{.a=1,.b=\"hello\",.inner={.x=3.12,.y=\" \",.z=2}};\n\nstd::string simple = fmt::format(\"{:s}\", outer); // :s means format as simple\nassert(simple == \"a|hello|3.12| |2\");\n\nstd::string  extended = fmt::format(\"{:e}\",outer); // :e means format as extended\nassert(extended == \"Outer{.a=1, .b=hello, .inner=Inner{.x=3.12, .y= , .z=2}}\");\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartinitus%2Ffmt-reflect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmartinitus%2Ffmt-reflect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartinitus%2Ffmt-reflect/lists"}