diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2012-02-24 23:06:43 -0500 |
---|---|---|
committer | Erik Schnetter <schnetter@cct.lsu.edu> | 2012-02-24 23:06:43 -0500 |
commit | 5a32e026e377a84b50cd5f57d1275872dbcf9af9 (patch) | |
tree | e90a7f4a00e92c2fc78b446735b68c8978b4a189 /Carpet/CarpetLib | |
parent | a935fb0d72e94e738bda03d5d629564086c97018 (diff) |
CarpetLib: Add vect::first and vect::last
Diffstat (limited to 'Carpet/CarpetLib')
-rw-r--r-- | Carpet/CarpetLib/src/vect.hh | 14 |
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) |