This is a solution for using reflection in a C++ project. With it, you can selectively apply reflection to your C++ types, and also get meta information about types at runtime.
- C++20 compatible compiler (MSVC, clang++)
- Supported OS: Windows, Linux
# Build MetaGenerator
premake5 vs2022 # Required for MetaGenerator (.NET)
dotnet build MetaGenerator/MetaGenerator.csproj -c [Debug|Release]
# Build CppReflection
# Windows
msbuild Reflection\CppReflection.vcxproj
# Linux
premake5 gmake
make CppReflection- Include headers (
Reflection/Include) - Setup MetaGenerator (See Generator Usage for details)
-
Automatic generation of metainformation
-
Assembly
- Dynamic loading
- Type extraction (by name)
⚠️ (except generic types)
-
Attributes (for types, field, methods, constructors)
-
Types (class / struct / generics)
- Name
- Namespace
- Size
- Parent types
- Lifetime control
- Constructors
- Destructors
- Fields
- Name
- Accesse (read / write) (local / static)
- Methods
- Name
- Signature (return type / argument types)
- Dynamic invoke
IsAchecks
-
Generic Types
- Template name
- Parameter types (Single, multiple and ellipsis)
⚠️ Only type parameters are supported (no value parameters)
-
Enums
- Name
- Namespace
- Base type
- Value names
- Values
-
Static and polymorphic type extraction
-
Cast (upcast, downcast, crosscast)
💡 Without RTTI
Here more information about how to use CppReflection.