From dbbfda0e96037da4f208ff8f00d181a5294484ae Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Sat, 22 Jun 2013 22:30:13 -0700 Subject: add new stuff stuff (with tests!), poison memcmp and strncpy --- src/common/utils2.hpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/common/utils2.hpp') 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 #include #include #include @@ -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 -- cgit v1.2.3-70-g09d2