Mercurial > ~dholland > hg > ag > index.cgi
comparison anagram/support/minmax.h @ 0:13d2b8934445
Import AnaGram (near-)release tree into Mercurial.
author | David A. Holland |
---|---|
date | Sat, 22 Dec 2007 17:52:45 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:13d2b8934445 |
---|---|
1 /* | |
2 * AnaGram, A System for Syntax Directed Programming | |
3 * Copyright 1993-2002 Parsifal Software. All Rights Reserved. | |
4 * See the file COPYING for license and usage terms. | |
5 * | |
6 * minmax.h - polymorphic min and max operators | |
7 */ | |
8 | |
9 #ifndef MINMAX_H | |
10 #define MINMAX_H | |
11 | |
12 | |
13 #ifndef __BCPLUSPLUS__ | |
14 #undef min | |
15 #undef max | |
16 | |
17 template <class Thing> | |
18 inline const Thing &min(const Thing &a, const Thing &b) { | |
19 return a <= b ? a : b; | |
20 } | |
21 | |
22 template <class Thing> | |
23 inline const Thing &max(const Thing &a, const Thing &b) { | |
24 return a >= b ? a : b; | |
25 } | |
26 | |
27 #endif /* __BCPLUSPLUS__ */ | |
28 | |
29 | |
30 #endif /* MINMAX_H */ |