#ifndef SORT_LIB_H
#define SORT_LIB_H

template <typename T>
class Sort
{
private:
	static int FindNextMinIndex(T arr[], const int start, const int length);
	static void Swap(T arr[], const int index1, const int index2);

public:
	static void SelectionSort(T arr[], const int length);

};



template <typename T>
int Sort<T>::FindNextMinIndex(T arr[], const int start, const int length)
{
	int minIndex = start;
	for (int i = start + 1; i <= length - 1; i++)
		if (arr[i] < arr[minIndex])	minIndex = i;

	return (minIndex);
}


template <typename T>
void Sort<T>::Swap(T arr[], const int index1, const int index2)
{
	T tmp = arr[index1];
	arr[index1] = arr[index2];
	arr[index2] = tmp;
}


template <typename T>
void Sort<T>::SelectionSort(T arr[], const int length)
{
	for (int top = 0; top <= length - 2; top++)
	{
		int minIndex = FindNextMinIndex(arr, top, length);
		Swap(arr, top, minIndex);
	}
}

#endif
Error	1	error LNK2019: unresolved external symbol "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl operator<<(class std::basic_ostream<char,struct std::char_traits<char> > &,class ArrayList<int> const &)" (??6@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AAV01@ABV?$ArrayList@H@@@Z) referenced in function _main	p04.obj

Any help?

Looks like you have given us the wrong class. Your problem seems with arrayList not Sort. Which if you add a quick test, works.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.