I am currently trying to implement a small example in C++. In the problem_description.hpp the userparam field does not occur. Why is that? Do I have to add it myself? Is there an example completely implemented in C++?
Thank you!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
in the C++ interface the problem description is implemented as a class and the userparam field is used to store the pointer to the instance of this class. See the code in grampc/cpp/src/problem_description.cpp where the actual probfct interface is implemented. Therefore, userparam is no longer available in the C++ interface. However, it is also no longer necessary since in C++ you can store data in attributes of the class and then access it from all methods. In the C variant this was only possible via global variables or by passing it as userparam to all functions.
The next version of GRAMPC will include at least one complete C++ example. However, I have attached you a minimal example that at least shows the basic usage. There is a lot that can be done more elegantly in C++ but I have it not available in a form that is ready to share.
Hello,
I am currently trying to implement a small example in C++. In the problem_description.hpp the userparam field does not occur. Why is that? Do I have to add it myself? Is there an example completely implemented in C++?
Thank you!
Dear Carlos,
in the C++ interface the problem description is implemented as a class and the userparam field is used to store the pointer to the instance of this class. See the code in grampc/cpp/src/problem_description.cpp where the actual probfct interface is implemented. Therefore, userparam is no longer available in the C++ interface. However, it is also no longer necessary since in C++ you can store data in attributes of the class and then access it from all methods. In the C variant this was only possible via global variables or by passing it as userparam to all functions.
The next version of GRAMPC will include at least one complete C++ example. However, I have attached you a minimal example that at least shows the basic usage. There is a lot that can be done more elegantly in C++ but I have it not available in a form that is ready to share.
Best regards,
Andreas Völz