Consider, for example, the following example, where two template classes depend on each other:
template <class T1, class T2, typename = typename std::enable_if<std::is_blah<T1>::value>::type, typename = typename std::enable_if<std::is_blah<T2>::value>::type> class someClass {
Right In situations like the ones described above, I have to write the same pattern over and over again. Needless to say, this is ugly, makes the code unreadable, tedious and unpleasant, includes many copies, etc. Etc.
There just has to be a reasonable decision.
One, of course, should #define this template. I donβt think this is a big problem, since of course I can #undef it as soon as I am done with all the declarations and definitions. But perhaps this is wrong; I am just green and I have seen people blaming any #defines.
Any other solutions? Or is this macro solution the best available?
source share