V
Victor Bazarov
Lieven said:I want to make a function template that is generic over all of the
stl-containers. This function can take a vector, a set or stack as input
and as second argument the class of the contents of the container. No
mather what. Is this possible?
My C++ is a bit rusty so this is the best I came up with:
template<class C, class Contents>
C test(C<Contents> c){
//do stuff with c
}
It probably would be easier to declare it
template<class C> C test(C c)
{
// do stuff with c
}
std::vector and std::set have different number of template arguments
(and it's not 1, either).
V