Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Class templates and inlining (OT)

Author: Sune Fischer

Date: 13:33:21 12/23/02

Go up one level in this thread


On December 23, 2002 at 16:20:48, Sune Fischer wrote:

Here's the class so far:

template <class T>
class CUtil {
	public:

		inline static T Max(T a,T b)
		{
			return (a>b?a:b);
		}

		inline static T Min(T a,T b)
		{
			return (a<b?a:b);
		}

		inline static T LimitRange(T x,T lower,T upper)
		{
			return (Min(Max(x,lower),upper));
		}

		inline static int InRange(T x,T lower,T upper)
		{
			if (x>upper) return 0;
			if (x<lower) return 0;
			return 1;
		}

		inline static void Swap(T x,T y)
		{
			T temp;

			temp=x;
			x=y;
			y=temp;
		}
};

what's broken?

-S.



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.