/*
** SellaNMS
** $Id: template_func.h,v 1.2 2006/01/24 07:08:09 sella Exp $
** Copyright (c) 2001-2005 Digital Genesis Software, LLC. All Rights Reserved.
** Released under the GPL Version 2 License.
** http://www.digitalgenesis.com
*/

#ifndef __DGS_INCLUDE_TEMPLATE_FUNC_H
#define __DGS_INCLUDE_TEMPLATE_FUNC_H

#ifdef HAVE_CONFIG_H
	#include "config.h"
#endif

#include "defaults.h"
#include <stl/utility>
#include <stl/functional>

template <class Ta, class Tb>
struct greater_pair_first : public greater<pair<Ta, Tb> > {
	bool operator()(const pair<Ta, Tb>& x, const pair<Ta, Tb>& y) {
		return (x.first > y.first);
	}
};
 
template <class Ta, class Tb>
struct greater_cpair_first : public greater<pair<Ta, Tb> > {
	bool operator()(const pair<Ta, Tb>& x, const pair<Ta, Tb>& y) {
		if (x.first == y.first) {
		 	return (x.second.first.compare(y.second.first) < 0);
		}
		return (x.first > y.first);
	}
};
 
template <class Ta, class Tb>
struct least_pair_first : public less<pair<Ta, Tb> > {
	bool operator()(const pair<Ta, Tb>& x, const pair<Ta, Tb>& y) {
		return (x.first) < (y.first);
	}
};

#endif

/*
** Local Variables:
** c-basic-offset: 3
** tab-width: 3
** End:
** vim:
** vim: noet ts=3 sw=3
*/
