//=========================================================================== // GoTools Core - SINTEF Geometry Tools Core library, version 2.0.1 // // Copyright (C) 2000-2007, 2010 SINTEF ICT, Applied Mathematics, Norway. // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation version 2 of the License. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., // 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. // // Contact information: E-mail: tor.dokken@sintef.no // SINTEF ICT, Department of Applied Mathematics, // P.O. Box 124 Blindern, // 0314 Oslo, Norway. // // Other licenses are also available for this software, notably licenses // for: // - Building commercial software. // - Building software whose source code you wish to keep private. //=========================================================================== 00015 #ifndef _FACTORIAL_H 00016 #define _FACTORIAL_H 00017 00018 00019 namespace Go { 00020 00021 00023 00024 00026 template<int N> 00027 struct Factorial { 00028 enum { value = N * Factorial<N-1>::value }; 00029 }; 00030 00031 00033 template <> 00034 struct Factorial<1> { 00035 enum { value = 1 }; 00036 }; 00037 00038 00041 template<typename T, int N> 00042 struct InverseFactorial { 00043 static inline T val() 00044 { 00045 return T(1) / T(Factorial<N>::value); 00046 } 00047 }; 00048 00049 00050 }; 00051 #endif // _FACTORIAL_H 00052
Generated on Tue Sep 21 15:44:17 2010 for GoTools Core by  doxygen 1.6.3