I'm trying to use default parameters in a template function. The following is a minimal example of the thing I'm trying to do:
In sort.h
template <typename T0, typename T1>
void sort(Vector<T0> &v0,Vector<T1> &v1=0)
{
//sort v0, if (v1 != 0) sort it according to v0
}
In main.cpp
#include "sort.h"
Vector<int> v0;
sort(v0);
This does not compile; the compiler gives the error "no matching function to call to 'sort'".
Basically this function should sort the vector v0 (arbitrary datatype). In addition, a second vector v1 (arbitrary) which is sorted in the same way as vector v0 can be given as parameter. Of course I could solve this problem simply by using overloaded functions, but since I'd like to expand the list of additional vectors up to 5, I would need like hundreds of different functions.
Update: Thanks for your responses so far. I have modified my problem description to give you a better idea of what I'm trying to do.
std::sort?