I just realized that you were talking about the C++ API and not the C++ plugin interface. This is now solved and possible with both. The latest version of the RoboDK API for C++ is available here.:
https://github.com/RoboDK/RoboDK-API/tree/master/C++
I tested the sample you provided and it works.
https://github.com/RoboDK/RoboDK-API/tree/master/C++
I tested the sample you provided and it works.