What this C++ template instantiation question tests
This easy question covers a common pitfall in C++ template programming: understanding how the compiler instantiates and links template definitions across multiple translation units. It's the kind of issue that trips up candidates who've worked with templates in practice but haven't internalized the rules.
The question asks you to reason about what happens when template code is split across header and implementation files. Success requires knowing where template definitions must live, how the compiler resolves instantiation, and what errors or unexpected behaviour can result. Interviewers use this to verify that you've debugged real template problems, not just read about them.
- Template definition vs. declaration
- Translation unit boundaries and ODR (One Definition Rule)
- Explicit instantiation and visibility