Skip to content

Commit

Permalink
Merge pull request #9 from acki-m/improve_docu_rttr_enable
Browse files Browse the repository at this point in the history
Improve docu for RTTR_ENABLE
  • Loading branch information
acki-m committed Jan 26, 2016
2 parents 48ccc2e + 2f2a085 commit 4e4522b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions doc/md_pages/tutorial/register_class_hierachy.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Within the current C++ standard it is not possible to extract a class hierarchy
Therefore the programmer has to put a certain macro inside every class in order to provide this information.
Additionally this macro will be needed to retrieve the information about the most derived [type](@ref rttr::type) of a current instance.

The macro you have to insert in the class declaration is named @ref RTTR_ENABLE()
The macro you have to insert in the class declaration is named: @ref RTTR_ENABLE()

Suppose we have a base struct called `Base`:
~~~~{.cpp}
Expand Down Expand Up @@ -37,14 +37,15 @@ So it is best practice to use the same order like in your class.
RTTR supports to register even virtual base classes.
@remark The only limitation you have is: It is **not** possible to register a class twice in the same class hierarchy.

When no class hierarchies are used at all, it is not necessary to use the macro. However it is best practice to place it inside every class.
When no class hierarchies are used at all, it is **not necessary** to use the macro. However it is best practice to place it inside every class.
This macro will also enable the possible usage of an own cast operator called: `rttr_cast`.
How this will be done, is discussed in the [next](@ref rttr_type_rttr_cast_page "Using rttr_cast") chapter.

Summary
-------
- to retrieve meta information of derived and base classes or using @ref rttr::rttr_cast "rttr_cast",
it is necessary to place the macro: @ref RTTR_ENABLE() inside every class declaration
- the macro is **not** needed when working with classes which will be not inherited, e.g. POD classes

<hr>

Expand Down
2 changes: 1 addition & 1 deletion src/rttr/rttr_enable.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ namespace detail

/*!
* \brief This macro is necessary in order to retrieve type information about the
* inheritance graph of a class.
* 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.
*
Expand Down

0 comments on commit 4e4522b

Please sign in to comment.