summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/angle/src/common/Optional.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/angle/src/common/Optional.h')
-rw-r--r--src/3rdparty/angle/src/common/Optional.h33
1 files changed, 12 insertions, 21 deletions
diff --git a/src/3rdparty/angle/src/common/Optional.h b/src/3rdparty/angle/src/common/Optional.h
index 256f38f329..822de4de51 100644
--- a/src/3rdparty/angle/src/common/Optional.h
+++ b/src/3rdparty/angle/src/common/Optional.h
@@ -10,23 +10,16 @@
#ifndef COMMON_OPTIONAL_H_
#define COMMON_OPTIONAL_H_
+#include <utility>
+
template <class T>
struct Optional
{
- Optional()
- : mValid(false),
- mValue(T())
- {}
+ Optional() : mValid(false), mValue(T()) {}
- explicit Optional(const T &valueIn)
- : mValid(true),
- mValue(valueIn)
- {}
+ Optional(const T &valueIn) : mValid(true), mValue(valueIn) {}
- Optional(const Optional &other)
- : mValid(other.mValid),
- mValue(other.mValue)
- {}
+ Optional(const Optional &other) : mValid(other.mValid), mValue(other.mValue) {}
Optional &operator=(const Optional &other)
{
@@ -49,10 +42,7 @@ struct Optional
return *this;
}
- void reset()
- {
- mValid = false;
- }
+ void reset() { mValid = false; }
static Optional Invalid() { return Optional(); }
@@ -64,14 +54,15 @@ struct Optional
return ((mValid == other.mValid) && (!mValid || (mValue == other.mValue)));
}
- bool operator!=(const Optional &other) const
- {
- return !(*this == other);
- }
+ bool operator!=(const Optional &other) const { return !(*this == other); }
+
+ bool operator==(const T &value) const { return mValid && (mValue == value); }
+
+ bool operator!=(const T &value) const { return !(*this == value); }
private:
bool mValid;
T mValue;
};
-#endif // COMMON_OPTIONAL_H_
+#endif // COMMON_OPTIONAL_H_