Compiler not finding my function
Strange problem, I just do not understand what is going on... basically, I have a series of template functions and template classes. I am trying to use the template functions within template classes to help me with some of the basic nitty gritty stuff like copying vectors.
I have a template class called state, the real version has many more members, but the one here has a vector<T> member. I am trying to write an assignment operator that can copy the from another state with a different template parameter. This assignment operator calls a template<class T,class U> copyVector function. Yet, when I compile it seems that the compiler cannot find the copyVector function. I don't know what I need to do to get this to bind.
Here is some sample code:
These are the error messages I get:
template<class T,class U>
void copyVector(std::vector<T, std::allocator<T> > &vct, std::vector<U, std::allocator<U> > &asg)
for(unsigned long i;i<asg.size();i++)
template<class U> state<T>& operator=(const state<U> &asg)
cont& operator=(const cont &asg)
test.cpp: In member function ‘state<T>& state<T>::operator=(const state<U>&) [with U = double, T = cont]’:
test.cpp:35: instantiated from here
test.cpp:20: error: no matching function for call to ‘copyVector(std::vector<cont, std::allocator<cont> >&, const std::vector<double, std::allocator<double> >&)’