Message from C, C++ discussions
A funny story happened to me this week. I'm not a fan of complex templates but decided to write a bitset class that can be parameterized with a enum (so I can use enum values as bit flags).
And to top of that, I wanted to add some handy functions for checking multiple values at once, using variadic templates.
So this is code I wrote (my thoughts were "oh, is it that simple?").
It compiled, run... but tests were failing for some reason...
I investigated a bit and found out that only the first values are considered in the function calls, and it seemed like I didn't actually use variadic templates. Seems like I used some kind of variadic functions (never used them before, so can't be sure).
Finally, I've rewritten it using real variadic templates. Become much more verbose, but at least it works correctly now (the bitset size is still not good, I'll replace it with magic_enum library call
Funny thing that if I didn't write tests for it, I could leave this code as it was and added some hard to catch bugs to my project. And I decided to write the tests only because the code was actually crashing (as I understand because of stack overflow on the bitset allocation, because of too big size).