C++ Design Pattern for Passing a Large Number of Parameters

前端 未结 6 924
小鲜肉
小鲜肉 2020-12-25 13:44

I have a reasonably-sized class that implements several logically-related algorithms (from graph theory). About 10-15 parameters are required as input to the algorithm. Thes

6条回答
  •  遥遥无期
    2020-12-25 14:40

    The Named Parameter Idiom might be useful here.

    a.runAlgorithm() = Parameters().directed(true).weight(17).frequency(123.45);
    

提交回复
热议问题