Diff of /blitz/meta/sum.h [d421cd] .. [2b666a]  Maximize  Restore

Switch to side-by-side view

--- a/blitz/meta/sum.h
+++ b/blitz/meta/sum.h
@@ -56,6 +56,29 @@
 
 };
 
+template<int N, int I, typename T_ret>
+class _bz_meta_vectorSumRet {
+public:
+    static const int loopFlag = (I < N-1) ? 1 : 0;
+
+    template<typename T_expr1>
+    static inline T_ret
+    f(const T_expr1& a)
+    {
+      return static_cast<T_ret>(a[I]) +
+	_bz_meta_vectorSumRet<loopFlag * N, loopFlag * (I+1), T_ret>::f(a);
+    }
+};
+
+template<typename T_ret>
+class _bz_meta_vectorSumRet<0,0, T_ret> {
+public:
+    template<typename T_expr1>
+    static inline _bz_meta_nullOperand f(const T_expr1&)
+    { return _bz_meta_nullOperand(); }
+
+};
+
 BZ_NAMESPACE_END
 
 #endif // BZ_META_SUM_H

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks