Reputation: 4076
template<typename T>
T foo(std::string key, T &def_value) {return def_value;}
template<>
std::string foo<std::string>(std::string key, std::string &def_value) {return def_value;}
fatal error LNK1169: one or more multiply defined symbols found
If I remove the 2nd definition, it compiles just fine.
Upvotes: 0
Views: 71
Reputation: 92261
The full specialization is no longer a template, but an ordinary function.
If it is included in several translation units, is has to be declared inline
.
Upvotes: 10