The data structure that best fits our purposes is the Python dictionary.
The main idea is that Python dictionary is a very rich data structure, containing not only the inputs, but also the logic required for setup and pricing. The C++ library should be unaware of financial concepts.
This is a very flexible and powerful design, as the C++ library can be thin (development focused on the mathematical and numerical aspects), require seldom updates, and focus on the “heavy lifting” - perform heavy computations.
See Using the C++ library for an example of communication between C++ and Python via a simple Python dictionary.
The main question is how to handle the Python dictionary inside the C++ library. We already mentioned two off-the-shelf solution. It also makes sense to build a custom solution in-house, as we do not need the most general interface. Two possible approaches are:
This flow is part of the framework chart Entire framework in one flowchart, with extra details.