summaryrefslogtreecommitdiff
path: root/src/common/utils2.hpp
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2013-06-22 22:30:13 -0700
committerBen Longbons <b.r.longbons@gmail.com>2013-06-23 22:07:50 -0700
commitdbbfda0e96037da4f208ff8f00d181a5294484ae (patch)
tree7a7b9982c6d98ddc2271aade72040ea9233a4a11 /src/common/utils2.hpp
parent83db3bbee4e19e7426a32ee89ad6c2d8e48260f2 (diff)
downloadtmwa-dbbfda0e96037da4f208ff8f00d181a5294484ae.tar.gz
tmwa-dbbfda0e96037da4f208ff8f00d181a5294484ae.tar.bz2
tmwa-dbbfda0e96037da4f208ff8f00d181a5294484ae.tar.xz
tmwa-dbbfda0e96037da4f208ff8f00d181a5294484ae.zip
add new stuff stuff (with tests!), poison memcmp and strncpy
Diffstat (limited to 'src/common/utils2.hpp')
-rw-r--r--src/common/utils2.hpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/common/utils2.hpp b/src/common/utils2.hpp
index 2218625..d7d6f8a 100644
--- a/src/common/utils2.hpp
+++ b/src/common/utils2.hpp
@@ -3,6 +3,7 @@
#include "sanity.hpp"
+#include <algorithm>
#include <functional>
#include <iterator>
#include <memory>
@@ -39,6 +40,26 @@ struct earray
{
return _data + size_t(max);
}
+
+ const T *begin() const
+ {
+ return _data;
+ }
+
+ const T *end() const
+ {
+ return _data + size_t(max);
+ }
+
+ friend bool operator == (const earray& l, const earray& r)
+ {
+ return std::equal(l.begin(), l.end(), r.begin());
+ }
+
+ friend bool operator != (const earray& l, const earray& r)
+ {
+ return !(l == r);
+ }
};
template<class T, class E>