An example might make it clearer. This is an implementation of the standard shuffle algorithm with templates:
That function alone will automatically work for any indexable container, with nearly any type of object inside the container (as long as it works with std::swap). You don't need to write separate versions for a plain array of ints, an std::vector of FooBar class objects, a Boost::multi_index set of booleans, etc.
template <typename T> void shuffle(T& t)
for(int i = t.size() - 1; i > 0; i--)
int j = rand() % i;
// ... fill v with values...