aboutsummaryrefslogtreecommitdiff
path: root/lib/util.h
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2019-01-13 19:23:52 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2019-01-13 19:23:52 +0900
commit23bf0e83aec1adaf81d9c50ce2385a98c20e3c93 (patch)
tree6fa9d5a34d7f5236798488ef8f0d76e57e879d55 /lib/util.h
parentd76424cb6c16cdef29761f00592db05989532a20 (diff)
parenta9bdc89f66ba283859fd9ca7383a7256198174ed (diff)
downloadlibquotient-23bf0e83aec1adaf81d9c50ce2385a98c20e3c93.tar.gz
libquotient-23bf0e83aec1adaf81d9c50ce2385a98c20e3c93.zip
Merge branch 'kitsune-workaround-stuck-invites'
Diffstat (limited to 'lib/util.h')
-rw-r--r--lib/util.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/util.h b/lib/util.h
index bae7f93f..ade6e8c2 100644
--- a/lib/util.h
+++ b/lib/util.h
@@ -108,6 +108,25 @@ namespace QMatrixClient
return *this;
}
+ bool operator==(const value_type& rhs) const
+ {
+ return !omitted() && value() == rhs;
+ }
+ friend bool operator==(const value_type& lhs,
+ const Omittable<value_type>& rhs)
+ {
+ return rhs == lhs;
+ }
+ bool operator!=(const value_type& rhs) const
+ {
+ return !operator==(rhs);
+ }
+ friend bool operator!=(const value_type& lhs,
+ const Omittable<value_type>& rhs)
+ {
+ return !(rhs == lhs);
+ }
+
bool omitted() const { return _omitted; }
const value_type& value() const
{
@@ -137,7 +156,7 @@ namespace QMatrixClient
}
value_type&& release() { _omitted = true; return std::move(_value); }
- operator value_type&() & { return editValue(); }
+ operator const value_type&() const & { return value(); }
const value_type* operator->() const & { return &value(); }
value_type* operator->() & { return &editValue(); }
const value_type& operator*() const & { return value(); }