ponder
3.2
C++ reflection library
|
Base class for writing custom Value visitors. More...
#include <valuevisitor.hpp>
Public Types | |
using | result_type = T |
Type of value visited. | |
Base class for writing custom Value visitors.
A value visitor acts like compile-time dispatchers which automatically calls the function which matches the actual type of the stored value. This is a more direct and straight-forward approach than using a runtime switch, based on value.kind() and then converting to the proper type. It also gives access to enum and user objects, which can give useful informations with no knowledge about the actual C++ class or enum.
The template parameter T is the type returned by the visitor.
To handle one of the possible types of the value, just write the corresponding operator()
function. Here is the list of the mapping between Ponder types and their corresponding C++ types:
Here an example of a unary visitor which creates an editor for the value based on its type