Implications of template declaration & definition

前端 未结 5 712
刺人心
刺人心 2020-12-16 00:43

From what I understand template classes and template functions (for the most part) must be declared and defined in the same header file. With that said:

  1. Are

5条回答
  •  生来不讨喜
    2020-12-16 01:34

    How To Organize Template Source Code

    Basically, you have the following options:

    • Make the template definition visible to compiler in the point of instantiation.
    • Instantiate the types you need explicitly in a separate compile unit, so that linker can find it.
    • Use keyword export (if available)

提交回复
热议问题