Why can’t templates be within extern “C” blocks?

Templates aren’t actual code, they’re just guidelines to the compiler for how to generate the code once the template parameters are known. As such they don’t actually exist until you try to use them. You can’t provide linkage to something that doesn’t exist.

Leave a Comment