tags:

views:

299

answers:

1
+4  A: 

T a[] means you expect an array of T as the parameter type - but thats a C array, not a class type. Your class template Array is just that - a class template that only happens to provide convenience access to its contents via operator[]().

To fix the first error change Quicksort()s signature to:

template<class T>
void Quicksort(T& a, int first, int last)

Then there is the problem that you use T for a local variable pivot. To do that generically with containers, it is more or less standard to provide a typedef named value_type for the contained types (the values) of the container:

template<class T>
class Array 
{
public:
    typedef T value_type;
    // ...
};

With that convention you can declare pivot as follows:

T::value_type pivot;
Georg Fritzsche
Charles Salvia
Oops, of course. Thanks Charles.
Georg Fritzsche
that worked thanks..
ritual