Why do templates specialisations need to be inlined?
问题 I am referring to this answer: https://stackoverflow.com/a/4447057/930315 I ran into a similar issue as the OP of the cited question, having a function template<typename T> void func(T& val); and its specialization template<> void func<mytype>(mytype& val); resulted in a duplicate symbols linker error (the methods are implemented in a '.tpp' file that is included at the end of my header). adding inline to the specialised function resolved the issue. Why? 回答1: According to clause 3.2:4 in the