4 ms·
C++ templates are similar to macros: they run at compile time to generate code, but they're a lot harder to use.
by stefano 17y ago
C++ templates are similar to macros: they run at compile time to generate code, but they're a lot harder to use.
- rkts 17y agoTrue, but in this case, the template serves a different purpose from the macro. It's there to make zap polymorphic, and would be unnecessary in a dynamic or type-inferred language. The main point is that pg's macro can be implemented as an ordinary function in a language that has references.