When you want to register a method or a constructor which contains default arguments, you have to provide them RTTR explicitly. The reason for this is, default arguments are not part of the function signature. Nevertheless, RTTR provides a mechanism to register functions with default arguments.
Please take a look at following example:
The default arguments has to be provided via the function: default_arguments(). Place the call in the ()
operator of the returned bind object.
The function has following synopsis:
The values will be copied internally and will be provided during invoke of the method or constructor, when the corresponding argument is missing:
- Remarks
- The given arguments must match the signature from the starting position to the right most argument.
The following snippet will not compile and will raise a static_assert:
Every method and constructor can have default arguments.