I would like to be able to specify through a boolean which of the two variables that I need to use at compile time, all of this without direct SFINAE . Only one function, similar to std::conditional , but not returning types.
So, for example, in the test class, I would like to have
class test { template <class T, bool first, MAGIC_HAPPENS var> void apply_it(T &t) { for (auto &p : var) p.apply(t); } std::vector<myfunction> var1; std::vector<myfunction> var2; }
The use is simple: if I specify first == true , then it should apply a loop with var == var1 , otherwise var == var2 .
Is it possible?
source share