I have a simulation code where I want to perform some configuration at compile time: for example, I need to determine the dimension, data type and class containing low-level operations (compilation time for inline).
Sort of:
template <int DIMENSION, class DATATYPE, class OPERATIONS> class Simulation{ ... } template <int DIMENSION, class DATATYPE, class OPERATIONS> class SimulationNode{ ... } template <int DIMENSION, class DATATYPE, class OPERATIONS> class SimulationDataBuffer{ ... }
Firstly, it is extremely unpleasant to write the entire set of parameters for each class. Secondly, even worse, it may be necessary to introduce an additional parameter, and I will have to change all the classes.
Is there something like a structure for template parameters?
Sort of
struct { DIMENSION = 3; DATATYPE = int; OPERATIONS = SimpleOps; } CONFIG; template <class CONFIG> class Simulation{ ... } template <class CONFIG> class SimulationNode{ ... } template <class CONFIG> class SimulationDataBuffer{ ... }
source share