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_CORE_DETAILS_UNDERSCORE_UNDERSCORE_HPP 00025 #define IVL_CORE_DETAILS_UNDERSCORE_UNDERSCORE_HPP 00026 00027 namespace ivl { 00028 00029 namespace core_details { 00030 00031 struct transpose_arg { }; 00032 00033 struct complex_transpose_arg { }; 00034 00035 template<class J, class S> 00036 struct range_sup; 00037 00038 template<class J> 00039 struct range_sup_0 { 00040 J s; 00041 range_sup_0(J s):s(s){} 00042 template<class S> range_sup<J, S> operator,(const S& st) const 00043 { return range_sup<J, S>(s, st); } 00044 }; 00045 00046 class _class : 00047 public ivl::array<double, data::empty<> >, 00048 public ivl::internal::tuple<>, 00049 public ivl::index_array_all_type 00050 { 00051 public: 00052 using ivl::array<double, data::empty<> >::derived; 00053 typedef ivl::array<double, data::empty<> >::derived_type derived_type; 00054 00055 // for range 00056 template<class J> 00057 friend range_sup_0<J> operator ,(const J& first, _class) { return first; } 00058 template<class J, class S> 00059 friend range_sup_1<J, S> operator ,(const range_sup<J, S>& x, _class) { return range_sup_1<J, S>(x.j, x.s); } 00060 tuple<_class> operator, (_class) const { return tuple<_class>(_class()); } 00061 // 00062 00063 transpose_arg operator!() { return transpose_arg(); } 00064 00065 //complex_transpose_arg operator~() { return complex_transpose_arg(); } 00066 00067 // complex_transpose too 00068 index_array_all_type operator*() { return index_array_all_type(); } 00069 00070 00071 00072 // scalar construction 00073 //template<class T> 00074 //ivl::scalar<T> operator[](const T& t) { return ivl::scalar<T>(t); } 00075 template<class T> 00076 typename types::t_if<types::is_builtin<T>, ivl::scalar<T>, 00077 ivl::scalar<const T&> >::type operator[](const T& t) 00078 { 00079 return t; 00080 //return ivl::scalar<T>(t); 00081 } 00082 template<class T> 00083 ivl::scalar<T&> operator[](T& t) { return ivl::scalar<T&>(t); } 00084 00085 00086 using ivl::internal::tuple<>::operator,; 00087 00088 // ivl::lvalue_details::lval_base construction 00089 /* 00090 template<class T1> 00091 ivl::lvalue_details::lval_base<T1&> operator()(T1& t1) 00092 { 00093 return ivl::lvalue_details::lval_base<T1&>(t1); 00094 } 00095 00096 template<class T1, class T2> 00097 ivl::lvalue_details::lval_base<T1&, T2&> operator()(T1& t1, T2& t2) 00098 { 00099 return ivl::lvalue_details::lval_base<T1&, T2&>(t1, t2); 00100 } 00101 00102 template<class T1, class T2, class T3> 00103 ivl::lvalue_details::lval_base<T1&, T2&, T3&> operator()(T1& t1, T2& t2, T3& t3) 00104 { 00105 return ivl::lvalue_details::lval_base<T1&, T2&, T3&>(t1, t2, t3); 00106 } 00107 00108 template<class T1, class T2, class T3, class T4> 00109 ivl::lvalue_details::lval_base<T1&, T2&, T3&, T4&> operator()(T1& t1, T2& t2, T3& t3, T4& t4) 00110 { 00111 return ivl::lvalue_details::lval_base<T1&, T2&, T3&, T4&>(t1, t2, t3, t4); 00112 } 00113 00114 template<class T1, class T2, class T3, class T4, class T5> 00115 ivl::lvalue_details::lval_base<T1&, T2&, T3&, T4&, T5&> operator()(T1& t1, 00116 T2& t2, T3& t3, T4& t4, T5& t5) 00117 { 00118 return ivl::lvalue_details::lval_base<T1&, T2&, T3&, T4&, T5&>(t1, t2, t3, t4, t5); 00119 } 00120 00121 template<class T1, class T2, class T3, class T4, class T5, class T6> 00122 ivl::lvalue_details::lval_base<T1&, T2&, T3&, T4&, T5&, T6&> operator()(T1& t1, 00123 T2& t2, T3& t3, T4& t4, T5& t5, T6& t6) 00124 { 00125 return ivl::lvalue_details::lval_base<T1&, T2&, T3&, T4&, T5&, T6&>(t1, t2, t3, t4, t5, t6); 00126 } 00127 00128 template<class T1, class T2, class T3, class T4, class T5, class T6, 00129 class T7> 00130 ivl::lvalue_details::lval_base<T1&, T2&, T3&, T4&, T5&, T6&, T7&> operator()(T1& t1, 00131 T2& t2, T3& t3, T4& t4, T5& t5, T6& t6, T7& t7) 00132 { 00133 return ivl::lvalue_details::lval_base<T1&, T2&, T3&, T4&, T5&, T6&, T7&>(t1, t2, t3, t4, t5, t6, 00134 t7); 00135 } 00136 00137 template 00138 <class T1, class T2, class T3, class T4, class T5, 00139 class T6, class T7, class T8> 00140 ivl::lvalue_details::lval_base<T1&, T2&, T3&, T4&, T5&, T6&, T7&, T8&> operator()(T1& t1, 00141 T2& t2, T3& t3, T4& t4, T5& t5, T6& t6, T7& t7, T8& t8) 00142 { 00143 return ivl::lvalue_details::lval_base<T1&, T2&, T3&, T4&, T5&, T6&, T7&, T8&>( 00144 t1, t2, t3, t4, t5, t6, t7, t8); 00145 } 00146 00147 template 00148 <class T1, class T2, class T3, class T4, class T5, 00149 class T6, class T7, class T8, class T9> 00150 ivl::lvalue_details::lval_base<T1&, T2&, T3&, T4&, T5&, T6&, T7&, T8&, T9&> operator()(T1& t1, 00151 T2& t2, T3& t3, T4& t4, T5& t5, T6& t6, T7& t7, T8& t8, T9& t9) 00152 { 00153 return ivl::lvalue_details::lval_base<T1&, T2&, T3&, T4&, T5&, T6&, T7&, T8&, T9&>( 00154 t1, t2, t3, t4, t5, t6, t7, t8, t9); 00155 } 00156 00157 template 00158 <class T1, class T2, class T3, class T4, class T5, 00159 class T6, class T7, class T8, class T9, class T10> 00160 ivl::lvalue_details::lval_base<T1&, T2&, T3&, T4&, T5&, T6&, T7&, T8&, T9&, T10&> operator()(T1& t1, 00161 T2& t2, T3& t3, T4& t4, T5& t5, T6& t6, T7& t7, T8& t8, T9& t9, 00162 T10& t10) 00163 { 00164 return ivl::lvalue_details::lval_base<T1&, T2&, T3&, T4&, T5&, T6&, T7&, T8&, T9&, T10&>( 00165 t1, t2, t3, t4, t5, t6, t7, t8, t9, t10); 00166 } 00167 00168 00169 00170 template<class T1> 00171 ivl::lvalue_details::lval_base<const T1&> operator()(const T1& t1) 00172 { 00173 return ivl::lvalue_details::lval_base<const T1&>(t1); 00174 } 00175 00176 template<class T1, class T2> 00177 ivl::lvalue_details::lval_base<const T1&, const T2&> operator()(const T1& t1, const T2& t2) 00178 { 00179 return ivl::lvalue_details::lval_base<const T1&, const T2&>(t1, t2); 00180 } 00181 00182 template<class T1, class T2, class T3> 00183 ivl::lvalue_details::lval_base<const T1&, const T2&, const T3&> operator()(const T1& t1, const T2& t2, 00184 const T3& t3) 00185 { 00186 return ivl::lvalue_details::lval_base<const T1&, const T2&, const T3&>(t1, t2, t3); 00187 } 00188 00189 template<class T1, class T2, class T3, class T4> 00190 ivl::lvalue_details::lval_base<const T1&, const T2&, const T3&, const T4&> operator()(const T1& t1, 00191 const T2& t2, const T3& t3, const T4& t4) 00192 { 00193 return ivl::lvalue_details::lval_base<const T1&, const T2&, const T3&, const T4&>(t1, t2, t3, 00194 t4); 00195 } 00196 00197 template<class T1, class T2, class T3, class T4, class T5> 00198 ivl::lvalue_details::lval_base<const T1&, const T2&, const T3&, const T4&, const T5&> operator()( 00199 T1& t1, 00200 const T2& t2, const T3& t3, const T4& t4, const T5& t5) 00201 { 00202 return ivl::lvalue_details::lval_base<const T1&, const T2&, const T3&, const T4&, const T5&>(t1, 00203 t2, t3, t4, t5); 00204 } 00205 00206 template<class T1, class T2, class T3, class T4, class T5, class T6> 00207 ivl::lvalue_details::lval_base<const T1&, const T2&, const T3&, const T4&, const T5&, const T6&> 00208 operator()(const T1& t1, 00209 const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6) 00210 { 00211 return ivl::lvalue_details::lval_base<const T1&, const T2&, const T3&, const T4&, const T5&, 00212 const T6&>(t1, t2, t3, t4, t5, t6); 00213 } 00214 00215 template<class T1, class T2, class T3, class T4, class T5, class T6, 00216 class T7> 00217 ivl::lvalue_details::lval_base<const T1&, const T2&, const T3&, const T4&, const T5&, const T6&, 00218 const T7&> operator()(const T1& t1, 00219 const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, 00220 const T7& t7) 00221 { 00222 return ivl::lvalue_details::lval_base<const T1&, const T2&, const T3&, const T4&, const T5&, 00223 const T6&, const T7&>(t1, t2, t3, t4, t5, t6, t7); 00224 } 00225 00226 template 00227 <class T1, class T2, class T3, class T4, class T5, 00228 class T6, class T7, class T8> 00229 ivl::lvalue_details::lval_base<const T1&, const T2&, const T3&, const T4&, const T5&, const T6&, 00230 const T7&, const T8&> operator()(const T1& t1, 00231 const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, 00232 const T7& t7, const T8& t8) 00233 { 00234 return ivl::lvalue_details::lval_base<const T1&, const T2&, const T3&, const T4&, const T5&, 00235 const T6&, const T7&, const T8&>( 00236 t1, t2, t3, t4, t5, t6, t7, t8); 00237 } 00238 00239 template 00240 <class T1, class T2, class T3, class T4, class T5, 00241 class T6, class T7, class T8, class T9> 00242 ivl::lvalue_details::lval_base<const T1&, const T2&, const T3&, const T4&, const T5&, const T6&, 00243 const T7&, const T8&, const T9&> operator()(const T1& t1, 00244 const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, 00245 const T7& t7, const T8& t8, const T9& t9) 00246 { 00247 return ivl::lvalue_details::lval_base<const T1&, const T2&, const T3&, const T4&, const T5&, 00248 const T6&, const T7&, const T8&, const T9&>( 00249 t1, t2, t3, t4, t5, t6, t7, t8, t9); 00250 } 00251 00252 template 00253 <class T1, class T2, class T3, class T4, class T5, 00254 class T6, class T7, class T8, class T9, class T10> 00255 ivl::lvalue_details::lval_base<const T1&, const T2&, const T3&, const T4&, const T5&, const T6&, 00256 const T7&, const T8&, const T9&, const T10&> operator()(const T1& t1, 00257 const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, 00258 const T7& t7, const T8& t8, const T9& t9, const T10& t10) 00259 { 00260 return ivl::lvalue_details::lval_base<const T1&, const T2&, const T3&, const T4&, const T5&, 00261 const T6&, const T7&, const T8&, const T9&, const T10&>( 00262 t1, t2, t3, t4, t5, t6, t7, t8, t9, t10); 00263 } 00264 */ 00265 }; 00266 00267 } /* namespace core_details */ 00268 00269 static core_details::_class _; 00270 00271 } /* namespace ivl */ 00272 00273 #endif // IVL_CORE_DETAILS_UNDERSCORE_UNDERSCORE_HPP