Hi,
Does anyone have an insight on why the code below produces linker errors claiming that the assignment operator template functions were not found ("LNK2019: unresolved external symbol", using MSVC 2008)? I assume I've messed something up, but can't figure it out myself...
Code:
-- a.h --
class A
{
template <class T> operator=(const T& value);
};
-- a.cpp --
#include "a.h"
#include <iostream>
template <typename T>
A& A::operator=(const T& value)
{
std::cout << value << std::endl;
return *this;
}
-- main.cpp --
#include "a.h"
int main(int argc, char** argv)
{
A a;
a = 1.0f;
a = "test";
return 0;
}
Any help or thoughts on the subject would be greatly appreciated