diff options
Diffstat (limited to 'src/common/utils2.hpp')
-rw-r--r-- | src/common/utils2.hpp | 21 |
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> |