GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - chocolacula/easy_reflection_cpp: Reflection and serialization library. Supports json, yaml, and binary. Uses libClang AST for code generation.

This repository was archived by the owner on Aug 20, 2026. It is now read-only.
BranchesTags
Open more actions menu

Latest commit

 

History

164 Commits
164 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
.vscode
.vscode
 
 
benchmarks
benchmarks
 
 
cmake
cmake
 
 
example
example
 
 
generator
generator
 
 
library
library
 
 
readme
readme
 
 
tests
tests
 
 
vcpkg @ a3df696
vcpkg @ a3df696
 
 
.clang-format
.clang-format
 
 
.clang-tidy
.clang-tidy
 
 
.clangd
.clangd
 
 
.dockerignore
.dockerignore
 
 
.gitignore
.gitignore
 
 
.gitmodules
.gitmodules
 
 
CMakeLists.txt
CMakeLists.txt
 
 
Dockerfile
Dockerfile
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
vcpkg.json
vcpkg.json
 
 
version.yml
version.yml
 
 

Repository files navigation

Easy Reflection for C++

CMake build and test Listed on Awesome C++

This project is mostly a proof of concept, built on the idea that something we need and want could have been implemented many years ago. If you're curious about the details of how it works, you can find them in this DEV article. Many parts were made just for fun, so they may look interesting or weird. If you want something similar in production, use glaze instead.

It parses C++ source code for special attributes. In the most straightforward situation, you only need to mark an object by [[er::reflect]] attribute. All other work will be done by the code generation tool and reflection library.

The main idea is to use kinda dynamic typing for some type agnostic operations, like copying or getting the name of a type.
It makes it possible to determine the type in runtime and do the right job - print, serialize/deserialize.

Features

  • Linux, MacOS and Windows, x86 and ARM support
  • translate enums to string and vice versa
  • invoke methods
  • support of stl containers like std::vector, std::list, std::map, etc.
  • smart pointers support
  • native serialization directly to an object and without third parties for:
    • JSON
    • YAML 1.2 even with anchors, but keep in mind that variables behind anchors have to be the same type.
    • binary with Variable Length Quantity to reduce number of bytes
  • debug printing
  • understandable errors

Quick start

Look at Installation guide and install the solution.

Then define your object and use [[er::reflect]]:

class [[er::reflect]] Object {
 public:
  std::string field_str;
  int field_int;

  std::vector<int> field_vector;
}

And serialize/deserialize it in one shot:

#include "generated/reflection.h"
#include "er/serialization/json.h"

using namespace serialization;

...
auto str = json::to_string<Object>(obj).unwrap();
obj = json::from_string<Object>(str).unwrap();
...

For more details see How To Use.

Performance

The repository includes benchmarks folder, feel free to check it on your own hardware.

JSON is faster than nlohmann json. Serialization is the same fast as rapid json, deserialization is a little faster with simdjson parser and more than twice slower without.

YAML is blazingly faster than yaml-cpp if I did the benchmark right.

Note: Other libraries do not always convert string-represented values to int, float, or bool and don't create instances of std::string until you call something like .get<int>(). Easy Reflection, on the other hand, provides ready-made objects with all values within.

Core i5 benchmarks

Memory

The ratio of the content length in bytes

About

Reflection and serialization library. Supports json, yaml, and binary. Uses libClang AST for code generation.

Topics

clangcpp17jsonreflectionserdeserializationyaml

Resources

Readme
Apache-2.0 license
Activity

Stars

103 stars

Watchers

3 watching

Forks

7 forks
Report repository

Releases

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.