⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 loop3.hpp

📁 矩阵运算源码最新版本
💻 HPP
字号:
// Software License for MTL// // Copyright (c) 2007 The Trustees of Indiana University. All rights reserved.// Authors: Peter Gottschling and Andrew Lumsdaine// // This file is part of the Matrix Template Library// // See also license.mtl.txt in the distribution.#ifndef META_MATH_LOOP3_INCLUDE#define META_MATH_LOOP3_INCLUDE// See below for examplenamespace meta_math {template <unsigned long Index0, unsigned long Max0, unsigned long Index1, unsigned long Max1,	  unsigned long Index2, unsigned long Max2>struct loop3{    static unsigned long const index0= Index0 - 1, next_index0= Index0,	                       index1= Index1 - 1, next_index1= Index1,            	               index2= Index2 - 1, next_index2= Index2 + 1;};template <unsigned long Index0, unsigned long Max0, unsigned long Index1, unsigned long Max1, 	  unsigned long Max2>struct loop3<Index0, Max0, Index1, Max1, Max2, Max2>{    static unsigned long const index0= Index0 - 1, next_index0= Index0,	                       index1= Index1 - 1, next_index1= Index1 + 1,            	               index2= Max2 - 1, next_index2= 1;};template <unsigned long Index0, unsigned long Max0, unsigned long Max1, unsigned long Max2>struct loop3<Index0, Max0, Max1, Max1, Max2, Max2>{    static unsigned long const index0= Index0 - 1, next_index0= Index0 + 1,	                       index1= Max1 - 1, next_index1= 1,            	               index2= Max2 - 1, next_index2= 1;};template <unsigned long Max0, unsigned long Max1, unsigned long Max2>struct loop3<Max0, Max0, Max1, Max1, Max2, Max2>{    static unsigned long const index0= Max0 - 1,	                       index1= Max1 - 1,            	               index2= Max2 - 1;};#if 0// ============================// Use the meta loop like this:// ============================template <unsigned long Index0, unsigned long Max0, unsigned long Index1, unsigned long Max1,	  unsigned long Index2, unsigned long Max2>struct loop3_trace : public loop3<Index0, Max0, Index1, Max1, Index2, Max2>{    typedef loop3<Index0, Max0, Index1, Max1, Index2, Max2> base;    typedef loop3_trace<base::next_index0, Max0, base::next_index1, Max1, base::next_index2, Max2> next_t;    void operator() ()    {	std::cout << this->index0 << " : " << this->index1 << " : " << this->index2 << "\n";	next_t() ();    }  };template <unsigned long Max0, unsigned long Max1, unsigned long Max2>struct loop3_trace<Max0, Max0, Max1, Max1, Max2, Max2>    : public loop3<Max0, Max0, Max1, Max1, Max2, Max2>{    void operator() ()    {	std::cout << this->index0 << " : " << this->index1 << " : " << this->index2 << "\n";    }  };#endif} // namespace meta_math#endif // META_MATH_LOOP3_INCLUDE

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -