I have this code
template <class N>
inline N swap(N a, N b) {
int c = *a;
*a = *b;
*b = c;
}
with this function I get this error: error: 'N' does not name a type
Error compiling.
This is my normal function.
inline void swap(int *a, int *b) {
int c = *a;
*a = *b;
*b = c;
}
My problem is that I need to use this function with unsigned and normal ints. Is it possible to do this with templates.
std::swap?Tis not an integer? Or the arguments not pointers?