Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/RogerDX9/cppbindings

Template based reflection for C++
https://github.com/RogerDX9/cppbindings

Last synced: 18 days ago
JSON representation

Template based reflection for C++

Awesome Lists containing this project

README

        

# CPP Bindings

Template based reflection for C++

## Getting Started

A function with all members described and template specification are required per class:

```C++
struct Wheel
{
int m_rotation;
std::vector m_screws;

static void tieMembers(CBind::IClassType * classType, std::string & outName) // a function
{
classType->tie("m_rotation", &Wheel::m_rotation);
classType->tie("m_screws", &Wheel::m_screws);

outName = "Wheel";
}
};

namespace CBind
{
template<> struct TypeInfo : public ClassType {}; // template specification
}
```

* [Defined types are here](https://github.com/spoiltos/cppbindings/blob/master/cppbindings/Reflection.h)
* [Example of use](https://github.com/spoiltos/cppbindings/blob/master/example/main.cpp)

## Compiled under:
* visual studio 2015 - build/vs2015/cppbindings.sln
* gcc 6.4.0 - run >G++ example/main.cpp