Author: Dave Gomboc
Date: 02:48:43 12/24/02
Go up one level in this thread
On December 23, 2002 at 16:33:21, Sune Fischer wrote:
>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.
C++ has built-in templates for most of those. Look up max, min, and swap in
your (up-to-date!) C++ documentation. They're all in the standard ("std")
namespace.
Dave
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.