C++: create own namespace

In this example i wanted to create a template function ‚max‘ which returns the maximum of to values. Because there is a funtion called max within the std namespace, i created myFunctions namespace for my own max function.

/*
 * Funktionen.cpp
 *
 *  Created on: 23.01.2014
 *      Author: ottp
 */


#include 

using namespace std;

namespace myFunctions {
template 
T max(T x, T y) {
	return (x > y) ? x : y;
}
}
int main(int argc, char **argv) {

	int a = 44, b = 45;
	float f = 33.2f, g = 99.2f;
	cout << myFunctions::max(a, b) << endl;
	cout << myFunctions::max(g, f) << endl;

	return 0;
}


It works nice.