Re:Solving the ABA Problem in Rust with Tagged Pointers
by amluto on Saturday February 15, 2025 @10:07AM
(#43059002)
Variadic templates help quite a lot compared to what older libraries did or even still do to approximate them. Check out boost::variant’s shenanigans — I recall a single-line file that includes <boost/variant.hpp> and doesn’t even instantiate the variant template taking several seconds to compile.
C++ compile times can be as bad as Rust's or worse. It does depend on how you structure things and how much you use templates. You don't need to have 10 layers of "zero cost abstraction" around everything. But that is the "proper" way to use it and what is now taught, so there is a lot of it out there and the standard library does it pervasively.
Variadic templates don't fix much compared to just writing straight line code or doing a tiny bit more work at runtime using stdarg.h.