templated functions help

Suppose I have a container of a data type. This container has the method .size() declared and implemented. The data type has relational operators defined. Is it possible to do something like below?


1
2
3
4
5
6
7
8
9
10
11
template <class T>
void bubbleSort(T& input)
{
    bubbleSort(input, input.size());
}

template <class T>
void bubbleSort(T& input, unsigned short size)
{
    // Sorting code goes here
}


The idea is that the first sorting algorithm is defined in terms of the second. I've tried to do this but, either its not possible, or Im doing it wrong. Any help would be much appreciated.
Yes, that will work as long as:

1) The bubbleSort function that accepts 2 parameters is defined or prototyped first

2) size() returns an unsigned short... or you change that unsigned short to something more reasonable, like size_t
Great, thanks.
Topic archived. No new replies allowed.