Conditionally providing enum reflection in CPP

41 Views Asked by At

I am trying to create a structure that takes a non-type parameter (an enum) that can be void in some cases. If the non-type parameter is not void, the structure will need another parameter which of type of the enum.

Currently, it is defined as

template<typename U, typename T, T... TArgs> // TArgs was made variadic making this not mandatory
struct {"some variables that depend on the above params" }target_struct;

The struct object is created as follows

target_structure<double, trial_enum, trial_enum::one_value> obj_1;
target_structure<double, void> obj_2; // To change

I want the second declaration to be like:

target_structure<double> obj_2;

What are the changes necessary for this? Even the variadic parameter is not a neat thing.

0

There are 0 best solutions below