Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
R

refl-cpp

> DevOps
Open source

Static reflection for C++17 (compile-time enumeration, attributes, proxies, overloads, template functions, metaprogramming).

1.2K stars0 likes0 views
WebsiteGitHub

About

Static reflection for C++17 (compile-time enumeration, attributes, proxies, overloads, template functions, metaprogramming).

Documentation

refl-cpp is a header-only library which provides compile-time reflection and introspection capabilities to C++. By encoding type metadata in the type system, refl-cpp allows you to process types and their fields and functions via constexpr and template metaprogramming.

Using refl-cpp in your project? I want to hear about it: contact me by email (see my profile), open an issue or add the #refl-cpp tag to your topics!

Have a question? Try asking in the Gitter channel.

Want to support refl-cpp? Consider making a donation.

Table of Contents

  • Introduction
    • Examples
    • Motivation
    • Performance
  • Integration
    • Requirements
    • CMake
    • Packages
  • Documentation
  • Testing
  • Contributors
  • License

Introduction

refl-cpp aims to provide a generic reflection system that is flexible enough to suit your needs while maintaining a relatively small API surface.

Some nice things refl-cpp supports out-of-the-box:

  • custom attributes - constexpr std::tuples associated with types and member descriptors
  • proxy types - build generic proxy types with the same members as T that can be used to wrap or extend functionality
  • overloaded functions - you only declare your overloaded function once - refl-cpp knows how to work with it
  • template types - use reflection with your containers and other templates; template types are perfectly-well supported
  • template functions - refl-cpp also works with template functions, when the template parameters can be inferred from the function parameters

Examples

  • Implement a simple serialization system - example-serialization.cpp - View in Compiler Explorer Implements an efficient generic serialization procedure from scratch

  • Simple SQL database abstraction - example-dao.cpp - View in Compiler Explorer Implements a basic ORM system which can generate SQL statements at compile-time from model classes using custom properties

  • Iterate base classes with bases<> - example-inheritance.cpp - [View in Compiler Explorer](https://godbolt.org/#z:OYLghAFBqd5QCxAYwPYBMCmBRdBLAF1QCcAaPECAMzwBtMA7AQwFtMQByARg9KtQYEAysib0QXACx8BBAKoBnTAAUAHpwAMvAFYTStJg1DIApACYAQuYukl9ZATwDKjdAGFUtAK4sGIABz%2BpK4AMngMmAByPgBGmMQgAJykAA6oCoRODB7evgFBa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No open issues yet, or sync has not completed.

> Tags

C++cppcpp17header-onlymetaprogramming

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
CategoryDevOps
PricingOpen source

> Related tools

D
Docker
容器化平台,标准化应用交付
G
GitHub Actions
GitHub 原生 CI/CD 工作流
N
Nginx
高性能 Web 服务器与反向代理