metaprog.h | metaprog.h | |||
---|---|---|---|---|
// -*- C++ -*- | ||||
/************************************************************************** * | /************************************************************************** * | |||
* blitz/meta/metaprog.h Useful metaprogram declarations | * blitz/meta/metaprog.h Useful metaprogram declarations | |||
* | * | |||
* $Id: metaprog.h,v 1.3 2001/01/26 21:34:59 tveldhui Exp $ | * $Id: metaprog.h,v 1.6 2005/05/07 04:17:57 julianc Exp $ | |||
* | * | |||
* Copyright (C) 1997-2001 Todd Veldhuizen <tveldhui@oonumerics.org> | * Copyright (C) 1997-2001 Todd Veldhuizen <tveldhui@oonumerics.org> | |||
* | * | |||
* This program is free software; you can redistribute it and/or | * This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU General Public License | * modify it under the terms of the GNU General Public License | |||
* as published by the Free Software Foundation; either version 2 | * as published by the Free Software Foundation; either version 2 | |||
* of the License, or (at your option) any later version. | * of the License, or (at your option) any later version. | |||
* | * | |||
* This program is distributed in the hope that it will be useful, | * This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | * GNU General Public License for more details. | |||
* | * | |||
* Suggestions: blitz-dev@oonumerics.org | * Suggestions: blitz-dev@oonumerics.org | |||
* Bugs: blitz-bugs@oonumerics.org | * Bugs: blitz-bugs@oonumerics.org | |||
* | * | |||
* For more information, please see the Blitz++ Home Page: | * For more information, please see the Blitz++ Home Page: | |||
* http://oonumerics.org/blitz/ | * http://oonumerics.org/blitz/ | |||
* | * | |||
************************************************************************** | ************************************************************************** | |||
* | */ | |||
* $Log: metaprog.h,v $ | ||||
* Revision 1.3 2001/01/26 21:34:59 tveldhui | ||||
* Updated docs to reflect isnan -> blitz_isnan change | ||||
* | ||||
* Revision 1.2 2001/01/24 20:22:51 tveldhui | ||||
* Updated copyright date in headers. | ||||
* | ||||
* Revision 1.1.1.1 2000/06/19 12:26:13 tveldhui | ||||
* Imported sources | ||||
* | ||||
* Revision 1.2 1998/03/14 00:08:44 tveldhui | ||||
* 0.2-alpha-05 | ||||
* | ||||
* Revision 1.1 1997/07/16 14:51:20 tveldhui | ||||
* Update: Alpha release 0.2 (Arrays) | ||||
* | ||||
*/ | ||||
#ifndef BZ_META_METAPROG_H | #ifndef BZ_META_METAPROG_H | |||
#define BZ_META_METAPROG_H | #define BZ_META_METAPROG_H | |||
BZ_NAMESPACE(blitz) | BZ_NAMESPACE(blitz) | |||
// Null Operand | // Null Operand | |||
class _bz_meta_nullOperand { | class _bz_meta_nullOperand { | |||
public: | public: | |||
_bz_meta_nullOperand() { } | _bz_meta_nullOperand() { } | |||
}; | }; | |||
template<class T> inline T operator+(const T& a, _bz_meta_nullOperand) | template<typename T> inline T operator+(const T& a, _bz_meta_nullOperand) | |||
{ return a; } | { return a; } | |||
template<class T> inline T operator*(const T& a, _bz_meta_nullOperand) | template<typename T> inline T operator*(const T& a, _bz_meta_nullOperand) | |||
{ return a; } | { return a; } | |||
// MetaMax | // MetaMax | |||
template<int N1, int N2> | template<int N1, int N2> | |||
class _bz_meta_max { | class _bz_meta_max { | |||
public: | public: | |||
enum { max = (N1 > N2) ? N1 : N2 }; | static const int max = (N1 > N2) ? N1 : N2; | |||
}; | }; | |||
// MetaMin | // MetaMin | |||
template<int N1, int N2> | template<int N1, int N2> | |||
class _bz_meta_min { | class _bz_meta_min { | |||
public: | public: | |||
enum { min = (N1 < N2) ? N1 : N2 }; | static const int min = (N1 < N2) ? N1 : N2; | |||
}; | }; | |||
BZ_NAMESPACE_END | BZ_NAMESPACE_END | |||
#endif // BZ_META_METAPROG_H | #endif // BZ_META_METAPROG_H | |||
End of changes. 7 change blocks. | ||||
24 lines changed or deleted | 8 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |