What this C++ template-instantiation question tests
This is an easy question that checks whether you understand how C++ templates are instantiated and resolved at compile time. It's the kind of conceptual check that appears in phone screens and early-round interviews to filter for solid language fundamentals.
The question asks you to trace through a code snippet and predict its output. Success requires understanding template specialization, function overload resolution, and how the compiler selects the correct version of a template when multiple candidates exist. You'll need to reason about the types involved and which specialization matches best.
- Template parameter deduction
- Specialization vs. instantiation
- Overload resolution order
- Compile-time vs. runtime behavior