#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

void display( vector< int >& vect );
void initialize( vector< int >& source );
void do_work( vector< int >& source, vector< int >& destination );
void clean_up( vector< int >& source, vector< int >& destination );

int main()
{
	vector< int > source;
	vector< int > destination;

	initialize( source );
	cout << "Initialized: ";
	display( source );

	do_work( source, destination );
	cout << "Destination sorted: ";
	display( destination );
	cout << "            Source: ";
	display( source );

	clean_up( source, destination );
	cout << "Finally,\n";
	cout << "destination: ";
	display( destination );
	cout << "     source: ";
	display( source );
	return 0;
}

void initialize( vector< int >& source )
{
	source.assign( 5, 10 ); // populate src with 5 elem, with value 10
	source[ 2 ] = 200;
	source[ 4 ] = 4;
}

void do_work( vector< int >& source, vector< int >& destination )
{
	destination = source;
	sort( destination.begin(), destination.end() );
}

void clean_up( vector< int >& source, vector< int >& destination )
{
	source.clear();
	destination.clear();
}

void display( vector< int >& vect )
{
	if ( vect.size() == 0 ) {
		cout << "empty\n";
		return;
	}
	for ( size_t idx = 0; idx < vect.size(); ++idx )
	{
		cout << vect[ idx ] << ' ';
	}
	cout << '\n';
}