79331334

Date: 2025-01-05 18:45:32
Score: 0.5
Natty:
Report link

Templates are a compile-time feature in C++, and the compiler only generates code for a template when it encounters a specific instantiation of that template.

When the compiler processes the SimpleVector code, it sees the definitions of template member functions such as sortData, size, and capacity as templates. However, the compiler does not generate any actual code for these template functions at this stage because there are no concrete types () specified. Templates are only blueprints until instantiated.

Since there are no explicit instantiations of SimpleVector in SimpleVector code ( no SimpleVector or SimpleVector), the compiler effectively skips generating code for these functions.

The compiler generates the actual code for a template function or class only when it knows the type T.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (0.5):
Posted by: oran ben david