What this C++ template instantiation question tests
This is an easy conceptual question about how C++ template member functions are instantiated by the compiler. It probes whether you understand that templates are compiled lazily—that is, which member functions actually generate code at compile time.
To answer correctly, you need to reason about what the compiler does when you instantiate a template class and call only some of its member functions. The key insight is understanding the difference between class template instantiation and member function instantiation, and recognizing which functions the compiler must generate code for versus which it can safely skip.
- Template instantiation models (eager vs. lazy)
- Point-of-instantiation rules
- Unused member function elision