📄 index.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 MTL_INDEX_INCLUDE#define MTL_INDEX_INCLUDE// The whole idea of changing indices is insane!// Thus, the file shouldn't exist at all.#include <boost/mpl/if.hpp>namespace mtl { namespace index {// Index like in C (identical with internal representation)struct c_index {};// Index like Fortranstruct f_index {};#if 0// Which index has type Ttemplate <class T> struct which_index{ typedef typename boost::mpl::if_c< traits::is_mtl_type<T>::value , typename T::index_type // mtl data shall know their type , c_index // others are by default c >::type type;};#endiftemplate <class T> struct which_index{ typedef typename T::index_type type;};// Change from internal representation to requested index typetemplate <class T> inline T change_to(c_index, T i) { return i; }template <class T> inline T change_to(f_index, T i) { return i + 1; }// Change from requested index type to internal representationtemplate <class T> inline T change_from(c_index, T i) { return i; }template <class T> inline T change_from(f_index, T i) { return i - 1; }}} // namespace mtl::index#endif // MTL_INDEX_INCLUDE
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -