aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetLib
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@cct.lsu.edu>2012-02-24 23:06:43 -0500
committerErik Schnetter <schnetter@cct.lsu.edu>2012-02-24 23:06:43 -0500
commit5a32e026e377a84b50cd5f57d1275872dbcf9af9 (patch)
treee90a7f4a00e92c2fc78b446735b68c8978b4a189 /Carpet/CarpetLib
parenta935fb0d72e94e738bda03d5d629564086c97018 (diff)
CarpetLib: Add vect::first and vect::last
Diffstat (limited to 'Carpet/CarpetLib')
-rw-r--r--Carpet/CarpetLib/src/vect.hh14
1 files changed, 14 insertions, 0 deletions
diff --git a/Carpet/CarpetLib/src/vect.hh b/Carpet/CarpetLib/src/vect.hh
index 32dc03213..7414d4965 100644
--- a/Carpet/CarpetLib/src/vect.hh
+++ b/Carpet/CarpetLib/src/vect.hh
@@ -454,6 +454,20 @@ inline int size (const vect<T,D>& a)
return D;
}
+/** Return the first element. */
+template<typename T,int D>
+inline int first (const vect<T,D>& a)
+{
+ return a[0];
+}
+
+/** Return the last element. */
+template<typename T,int D>
+inline int last (const vect<T,D>& a)
+{
+ return a[D-1];
+}
+
/** Return the index of the first maximum element. */
template<typename T,int D>
inline int maxloc (const vect<T,D>& a)