4 ms·
> Templates are objectively extremely difficult to understand and use correctly Really? Template metaprogramming is not the only use valid use of templates. Mo
by netheril96 10y ago
> Templates are objectively extremely difficult to understand and use correctly
Really? Template metaprogramming is not the only use valid use of templates. Most time a simple <class T> is enough and that is already a huge improvement over C.
- rubber_duck 10y agoEven most meta programming is not extremely difficult, unless we're talking boost level stuff, and more importantly it allows you to do super powerful interfaces for your API that are trivial to use (the implementation might get complex but consumption shouldn't be). Like say you have a collection of entities where each entity can have one or more components of different types. Now you want to find all entities with components A, B, C and the returned value should have typed references to components - it gets a bit hairy to implement but it's trivial to use and efficient.