Is there a way to cope with undefined reference error for template functions without implementing them in header?

后端 未结 2 638
栀梦
栀梦 2021-01-24 04:41

I hope the problem is clear. Is there an alternative way not to get undefined reference error without implementing template functions in header files? Thanks in advance.

相关标签:
2条回答
  • 2021-01-24 05:16

    If you know in advance which all instantiations you will need, you can instantiate them manually.

    0 讨论(0)
  • 2021-01-24 05:22

    Marshall Cline's C++-FAQ already deals with this.

    One way is to use export but I don't really recommend using it because not all compilers support it really!

    In fact C++0x Committee has voted out export out of the next C++ Standard.

    0 讨论(0)
提交回复
热议问题