In JavaScript I have a function -- new-able, treated like a class -- that receives two objects as paramters:
function StochasticStudy(inputs, outputMap) {
this.inputs = inputs;
this.outputMap = outputMap;
}
var inputs = {length: 10, averageLength: 3};
var outputMap = {K: 'stochastic10K', D: 'stochastic10D'};
new StochasticStudy(inputs, outputMap);
I need to do the same thing in C++. I know I could have a class with a constructor that receives all parameters individually:
class StochasticStudy {
StochasticStudy(length, averageLength, KMap, DMap);
};
StochasticStudy study = new StochasticStudy(10, 3, "stochastic10K", "stochastic10D");
But I don't like this. I want the inputs grouped together and the outputMap grouped separately -- especially since some inputs can be optional.
How can I achieve this in standard C++? I'd prefer to not pull in an obscure third-party library to do this and instead use as vanilla yet simple an approach as possible.