template <typename T>
void fill(TDArray<T>& da, T& ub, T& lb, int prec = 0) {
for(int i = 0; i < da.size() ; i++) {
da = generate(ub, lb, prec) ;
}
}
// Calling code
TDArray<int> tda(10) ;
fill(tda, 100, 0, 0) ;
I receive the following error from gcc on OS-X:
error: no matching function for call to 'fill(TDArray<int>&, int, int, int)'
Not to sure what is going on here. Any pointers on what is going on?
[C++] Function Template Parameter issue
I have a template function that has a template class as a parameter. I am getting an error when trying to call this function
Your function takes non-const references as parameters, and you try passing integer literals. You cannot bind a non-const reference to an integer literal like that. Try changing your function to take those parameters by value or const reference.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement