rttr_enable.h File - 0.9.6 |RTTR
rttr_enable.h File Reference
#include <type_traits>
#include "rttr/type.h"
#include "rttr/detail/misc/misc_type_traits.h"

Go to the source code of this file.

Namespaces

 rttr
 

Macros

#define RTTR_ENABLE(...)
 This macro is necessary in order to retrieve type information about the inheritance graph of a class. More...
 

Macro Definition Documentation

#define RTTR_ENABLE (   ...)

This macro is necessary in order to retrieve type information about the inheritance graph of a class.

When there is no inheritance graph, the macro is not needed, e.g. for POD types.

Put the macro inside every class, where you need the complete inheritance information about the class type.

struct Base
{
};

Place the macro RTTR_ENABLE() somewhere in the class, it doesn't matter if its under the public, protected or private class accessor section.

Into the derived class you put the same macro, but now as argument the name of the parent class. Which is in this case Base.

struct Derived : Base
{
};

When you use multiple inheritance you simply separate every class with a comma.

struct MultipleDerived : Base, Other
{
RTTR_ENABLE(Base, Other)
};
Remarks
Without this macro, it will not be possible to use rttr_cast or meta information in the type class, like: get_base_classes() or get_derived_classes().