aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetLib/src/defs.hh
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@cct.lsu.edu>2007-02-03 20:58:00 +0000
committerErik Schnetter <schnetter@cct.lsu.edu>2007-02-03 20:58:00 +0000
commit2b82da0e695a422775b0850f5f14e56f80f41cfa (patch)
treeb8c54c45e56c84c5488288b4e531335e8b696bc4 /Carpet/CarpetLib/src/defs.hh
parent3046f9acd4a16df5450f45b2e43e1395bed42ad1 (diff)
CarpetLib: Use AT to index std::vector
Define a macro AT() to index into std::vector. Depending on the macro NDEBUG, AT() is defined either as at(), providing index checking, or as operator[], providing no checking. darcs-hash:20070203205854-dae7b-a1999c88c95ba12b1ee66505f712aefdd67d7e6f.gz
Diffstat (limited to 'Carpet/CarpetLib/src/defs.hh')
-rw-r--r--Carpet/CarpetLib/src/defs.hh11
1 files changed, 11 insertions, 0 deletions
diff --git a/Carpet/CarpetLib/src/defs.hh b/Carpet/CarpetLib/src/defs.hh
index 3ae0b8261..afbabfba5 100644
--- a/Carpet/CarpetLib/src/defs.hh
+++ b/Carpet/CarpetLib/src/defs.hh
@@ -36,6 +36,17 @@ using namespace std;
+// Use this macro AT instead of vector's operator[] or at().
+// Depending on the macro NDEBUG, this macro AT either checks for
+// valid indices or not.
+#ifndef NDEBUG
+# define AT(index) at(index)
+#else
+# define AT(index) operator[](index)
+#endif
+
+
+
// Begin a new line without flushing the output buffer
char const * const eol = "\n";