diff options
author | Erik Schnetter <schnetter@gmail.com> | 2012-02-24 23:14:27 -0500 |
---|---|---|
committer | Barry Wardell <barry.wardell@gmail.com> | 2012-09-11 18:23:06 +0100 |
commit | 4a03c712564512358d49391f2800dbe847da94bf (patch) | |
tree | a049e260cc439a2fd4a0f5a686b995f08e729b61 /Carpet/CarpetLib | |
parent | a4ffa5451dc74ec103a3285a3eef66c92abb24d3 (diff) |
CarpetLib: Re-enable functional API for vect class
Diffstat (limited to 'Carpet/CarpetLib')
-rw-r--r-- | Carpet/CarpetLib/src/vect.hh | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/Carpet/CarpetLib/src/vect.hh b/Carpet/CarpetLib/src/vect.hh index 7414d4965..63a6b041b 100644 --- a/Carpet/CarpetLib/src/vect.hh +++ b/Carpet/CarpetLib/src/vect.hh @@ -527,16 +527,14 @@ inline T index (const vect<T,D>& lsh, const vect<T,D>& ind) // Higher order functions -#if 0 -// They are rarely used, so disable them +// This rarely used (and conflicts with Carpet::map), so it is renamed /** Return a new vector where the function func() has been applied to all elements. */ template<typename T, typename U, int D> -inline vect<U,D> map (U (* const func)(T x), const vect<T,D>& a) - CCTK_ATTRIBUTE_PURE; +inline vect<U,D> vmap (U (* const func)(T x), const vect<T,D>& a); template<typename T, typename U, int D> -inline vect<U,D> map (U (* const func)(T x), const vect<T,D>& a) +inline vect<U,D> vmap (U (* const func)(T x), const vect<T,D>& a) { vect<U,D> r; for (int d=0; d<D; ++d) r[d] = func(a[d]); @@ -547,8 +545,7 @@ inline vect<U,D> map (U (* const func)(T x), const vect<T,D>& a) element-wise to combine a and b. */ template<typename S, typename T, typename U, int D> inline vect<U,D> zip (U (* const func)(S x, T y), - const vect<S,D>& a, const vect<T,D>& b) - CCTK_ATTRIBUTE_PURE; + const vect<S,D>& a, const vect<T,D>& b); template<typename S, typename T, typename U, int D> inline vect<U,D> zip (U (* const func)(S x, T y), const vect<S,D>& a, const vect<T,D>& b) @@ -561,8 +558,7 @@ inline vect<U,D> zip (U (* const func)(S x, T y), /** Return a scalar where the function func() has been used to reduce the vector a, starting with the scalar value val. */ template<typename T, typename U, int D> -inline U fold (U (* const func)(U val, T x), U val, const vect<T,D>& a) - CCTK_ATTRIBUTE_PURE; +inline U fold (U (* const func)(U val, T x), U val, const vect<T,D>& a); template<typename T, typename U, int D> inline U fold (U (* const func)(U val, T x), U val, const vect<T,D>& a) { @@ -573,8 +569,7 @@ inline U fold (U (* const func)(U val, T x), U val, const vect<T,D>& a) /** Return a scalar where the function func() has been used to reduce the vector a, starting with element 0. */ template<typename T, typename U, int D> -inline U fold1 (U (* const func)(U val, T x), const vect<T,D>& a) - CCTK_ATTRIBUTE_PURE; +inline U fold1 (U (* const func)(U val, T x), const vect<T,D>& a); template<typename T, typename U, int D> inline U fold1 (U (* const func)(U val, T x), const vect<T,D>& a) { @@ -588,8 +583,7 @@ inline U fold1 (U (* const func)(U val, T x), const vect<T,D>& a) the vector a, starting with the scalar value val. */ template<typename T, typename U, int D> inline vect<U,D> scan0 (U (* const func)(U val, T x), U val, - const vect<T,D>& a) - CCTK_ATTRIBUTE_PURE; + const vect<T,D>& a); template<typename T, typename U, int D> inline vect<U,D> scan0 (U (* const func)(U val, T x), U val, const vect<T,D>& a) @@ -606,8 +600,7 @@ inline vect<U,D> scan0 (U (* const func)(U val, T x), U val, the vector a, starting with element 0. */ template<typename T, typename U, int D> inline vect<U,D> scan1 (U (* const func)(U val, T x), U val, - const vect<T,D>& a) - CCTK_ATTRIBUTE_PURE; + const vect<T,D>& a); template<typename T, typename U, int D> inline vect<U,D> scan1 (U (* const func)(U val, T x), U val, const vect<T,D>& a) @@ -619,7 +612,6 @@ inline vect<U,D> scan1 (U (* const func)(U val, T x), U val, } return r; } -#endif |