summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/state_trackers/clover/util/compat.hpp43
1 files changed, 30 insertions, 13 deletions
diff --git a/src/gallium/state_trackers/clover/util/compat.hpp b/src/gallium/state_trackers/clover/util/compat.hpp
index ca5b8921a40..eaae8c02940 100644
--- a/src/gallium/state_trackers/clover/util/compat.hpp
+++ b/src/gallium/state_trackers/clover/util/compat.hpp
@@ -36,6 +36,21 @@ namespace clover {
// source. Get rid of this as soon as everything can be
// compiled as C++11.
+ namespace detail {
+ template<typename R, typename S>
+ bool
+ ranges_equal(const R &a, const S &b) {
+ if (a.size() != b.size())
+ return false;
+
+ for (size_t i = 0; i < a.size(); ++i)
+ if (a[i] != b[i])
+ return false;
+
+ return true;
+ }
+ }
+
template<typename T>
class vector {
protected:
@@ -101,6 +116,11 @@ namespace clover {
return *this;
}
+ bool
+ operator==(const vector &v) const {
+ return detail::ranges_equal(*this, v);
+ }
+
void
reserve(size_type n) {
if (_capacity < n) {
@@ -199,6 +219,11 @@ namespace clover {
vector_ref(C &v) : p(&*v.begin()), n(v.size()) {
}
+ bool
+ operator==(const vector_ref &v) const {
+ return detail::ranges_equal(*this, v);
+ }
+
size_type
size() const {
return n;
@@ -306,6 +331,11 @@ namespace clover {
return std::string(v.begin(), v.end());
}
+ bool
+ operator==(const string &s) const {
+ return this->v == s.v;
+ }
+
void
reserve(size_type n) {
v.reserve(n);
@@ -382,19 +412,6 @@ namespace clover {
mutable vector<char> v;
};
- template<typename T>
- bool
- operator==(const vector_ref<T> &a, const vector_ref<T> &b) {
- if (a.size() != b.size())
- return false;
-
- for (size_t i = 0; i < a.size(); ++i)
- if (a[i] != b[i])
- return false;
-
- return true;
- }
-
class exception {
public:
exception() {}