ivl 679
|
00001 /* This file is part of the ivl C++ library <http://image.ntua.gr/ivl>. 00002 A C++ template library extending syntax towards mathematical notation. 00003 00004 Copyright (C) 2012 Yannis Avrithis <iavr@image.ntua.gr> 00005 Copyright (C) 2012 Kimon Kontosis <kimonas@image.ntua.gr> 00006 00007 ivl is free software; you can redistribute it and/or modify 00008 it under the terms of the GNU Lesser General Public License 00009 version 3 as published by the Free Software Foundation. 00010 00011 Alternatively, you can redistribute it and/or modify it under the terms 00012 of the GNU General Public License version 2 as published by the Free 00013 Software Foundation. 00014 00015 ivl is distributed in the hope that it will be useful, 00016 but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00018 See the GNU General Public License for more details. 00019 00020 You should have received a copy of the GNU General Public License 00021 and a copy of the GNU Lesser General Public License along 00022 with ivl. If not, see <http://www.gnu.org/licenses/>. */ 00023 00024 #ifndef IVL_ARRAY_ND_DETAILS_IMPL_ITER_ARRAY_ND_HPP 00025 #define IVL_ARRAY_ND_DETAILS_IMPL_ITER_ARRAY_ND_HPP 00026 00027 namespace ivl { 00028 00029 template<class A> 00030 array_nd<typename A::elem_type, const_link> 00031 const_iter_array_nd(const A& a) 00032 { 00033 return array_nd<typename A::elem_type, const_link>(a); 00034 } 00035 00036 template<class A> 00037 array_nd<typename A::elem_type, const_link> 00038 iter_array_nd(const A& a) 00039 { 00040 return array_nd<typename A::elem_type, const_link>(a); 00041 } 00042 00043 template<class A> 00044 array_nd<typename A::elem_type, rw_link> 00045 iter_array_nd(A& a) 00046 { 00047 return array_nd<typename A::elem_type, rw_link>(a); 00048 } 00049 00050 // ---- 00051 00052 template<class A, class S> 00053 array_nd<typename A::elem_type, const_link> 00054 const_iter_array_nd(const A& a, const array<size_t, S>& sz) 00055 { 00056 array_nd<typename A::elem_type, const_link> r(sz); 00057 r.setref(a); 00058 return r; 00059 } 00060 00061 template<class A, class S> 00062 array_nd<typename A::elem_type, const_link> 00063 iter_array_nd(const A& a, const array<size_t, S>& sz) 00064 { 00065 array_nd<typename A::elem_type, const_link> r(sz); 00066 r.setref(a); 00067 return r; 00068 } 00069 00070 template<class A, class S> 00071 array_nd<typename A::elem_type, rw_link> 00072 iter_array_nd(A& a, const array<size_t, S>& sz) 00073 { 00074 array_nd<typename A::elem_type, rw_link> r(sz); 00075 r.setref(a); 00076 return r; 00077 } 00078 00079 // ---- 00080 00081 template<class T, class S> 00082 array_nd<T, const_link> 00083 const_iter_array_nd(const T* a, const array<size_t, S>& sz) 00084 { 00085 array_nd<T, const_link> r(sz); 00086 r.setref(a, ivl::prod(sz)); 00087 return r; 00088 } 00089 00090 template<class T, class S> 00091 array_nd<T, const_link> 00092 iter_array_nd(const T* a, const array<size_t, S>& sz) 00093 { 00094 array_nd<T, const_link> r(sz); 00095 r.setref(a, ivl::prod(sz)); 00096 return r; 00097 } 00098 00099 template<class T, class S> 00100 array_nd<T, rw_link> 00101 iter_array_nd(T* a, const array<size_t, S>& sz) 00102 { 00103 array_nd<T, rw_link> r(sz); 00104 r.setref(a, ivl::prod(sz)); 00105 return r; 00106 } 00107 00108 } /* namespace ivl */ 00109 00110 #endif // IVL_ARRAY_ND_DETAILS_IMPL_ITER_ARRAY_ND_HPP