3 ms·
Using templates that way is totally possible. The problem is the nesting you end up with makes it hard to follow what is going on as you discovered. I like to
by sumtechguy 3y ago
Using templates that way is totally possible. The problem is the nesting you end up with makes it hard to follow what is going on as you discovered.
I like to use templates to replace #define style programming. As it makes it easier to debug what is going on and get the compiler to work for you instead of in the background and hoping it spits out the right thing to feed to the next stage in the compiler pipeline.
Many languages have these sort of 'yeah you can do that but you probably shouldnt' things. C++'s version of that is templates (for a long time it was giant trees of classes). You get sucked into how cool it is then realize you have made a horrible mistake and made a giant mess that you can barely comprehend much less debug.