Template Class/Function

Ryan Ham·2024년 6월 12일
0

C++

목록 보기
24/26

개요

Template Classes/Functions

  • Templates are more complex because their actual code is not generated until the template is instantiated with specific types. This instantiation typically happens in the files that use the template.

Key Points

  • The compiler needs the complete template definition to instantiate it.
  • If the definition is not visible at the point of instantiation, the compiler cannot generate the necessary code.

Header file에 template 선언만 하면 안 되는 이유

Templates require the full definition to be available at the point of instantiation, which is why their implementation is typically included in the header file.


Reference

https://hwan-shell.tistory.com/253

profile
🏦KAIST EE | 🏦SNU AI(빅데이터 핀테크 전문가 과정) | 📙CryptoHipsters 저자

0개의 댓글