[221] | 1 | /***************************************************************************
|
---|
| 2 | * blitz/meta/metaprog.h Useful metaprogram declarations
|
---|
| 3 | *
|
---|
| 4 | * $Id: metaprog.h,v 1.1.1.1 1999-04-09 17:59:03 ansari Exp $
|
---|
| 5 | *
|
---|
| 6 | * Copyright (C) 1997,1998 Todd Veldhuizen <tveldhui@seurat.uwaterloo.ca>
|
---|
| 7 | *
|
---|
| 8 | * This program is free software; you can redistribute it and/or
|
---|
| 9 | * modify it under the terms of the GNU General Public License
|
---|
| 10 | * as published by the Free Software Foundation; either version 2
|
---|
| 11 | * of the License, or (at your option) any later version.
|
---|
| 12 | *
|
---|
| 13 | * This program is distributed in the hope that it will be useful,
|
---|
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 16 | * GNU General Public License for more details.
|
---|
| 17 | *
|
---|
| 18 | * Suggestions: blitz-suggest@cybervision.com
|
---|
| 19 | * Bugs: blitz-bugs@cybervision.com
|
---|
| 20 | *
|
---|
| 21 | * For more information, please see the Blitz++ Home Page:
|
---|
| 22 | * http://seurat.uwaterloo.ca/blitz/
|
---|
| 23 | *
|
---|
| 24 | ***************************************************************************
|
---|
| 25 | * $Log: not supported by cvs2svn $
|
---|
| 26 | * Revision 1.2 1998/03/14 00:08:44 tveldhui
|
---|
| 27 | * 0.2-alpha-05
|
---|
| 28 | *
|
---|
| 29 | * Revision 1.1 1997/07/16 14:51:20 tveldhui
|
---|
| 30 | * Update: Alpha release 0.2 (Arrays)
|
---|
| 31 | *
|
---|
| 32 | */
|
---|
| 33 |
|
---|
| 34 | #ifndef BZ_META_METAPROG_H
|
---|
| 35 | #define BZ_META_METAPROG_H
|
---|
| 36 |
|
---|
| 37 | BZ_NAMESPACE(blitz)
|
---|
| 38 |
|
---|
| 39 | // Null Operand
|
---|
| 40 |
|
---|
| 41 | class _bz_meta_nullOperand {
|
---|
| 42 | public:
|
---|
| 43 | _bz_meta_nullOperand() { }
|
---|
| 44 | };
|
---|
| 45 |
|
---|
| 46 | template<class T> inline T operator+(const T& a, _bz_meta_nullOperand)
|
---|
| 47 | { return a; }
|
---|
| 48 | template<class T> inline T operator*(const T& a, _bz_meta_nullOperand)
|
---|
| 49 | { return a; }
|
---|
| 50 |
|
---|
| 51 |
|
---|
| 52 | // MetaMax
|
---|
| 53 |
|
---|
| 54 | template<int N1, int N2>
|
---|
| 55 | class _bz_meta_max {
|
---|
| 56 | public:
|
---|
| 57 | enum { max = (N1 > N2) ? N1 : N2 };
|
---|
| 58 | };
|
---|
| 59 |
|
---|
| 60 | // MetaMin
|
---|
| 61 |
|
---|
| 62 | template<int N1, int N2>
|
---|
| 63 | class _bz_meta_min {
|
---|
| 64 | public:
|
---|
| 65 | enum { min = (N1 < N2) ? N1 : N2 };
|
---|
| 66 | };
|
---|
| 67 |
|
---|
| 68 | BZ_NAMESPACE_END
|
---|
| 69 |
|
---|
| 70 | #endif // BZ_META_METAPROG_H
|
---|