Templatized Function Pointer?
I have the following few interesting pieces of code in my program:
What my compiler is telling me is that the << operator in my write function is ambiguous. I'm not entirely sure how templates and pointer functions interact (since pointer functions themselves are new to me), but as far as I can tell my code should be correct. Is there something I'm missing, or should I just go through and completely replace the template with a typedef?
-Rick
| //above template class definition template <class T> typedef void (*FunctionType)(T anItem); //inside template class definition void FunctionName(FunctionType visit); //in exterior code, template class definition included template <class T> void write(T anItem) { cout << anItem << " "; } //inside main function TemplateClass<char> Instance; //various inserts Instance.FunctionName(write); |
What my compiler is telling me is that the << operator in my write function is ambiguous. I'm not entirely sure how templates and pointer functions interact (since pointer functions themselves are new to me), but as far as I can tell my code should be correct. Is there something I'm missing, or should I just go through and completely replace the template with a typedef?
-Rick
