aboutsummaryrefslogtreecommitdiff
path: root/lib/events/accountdataevents.h
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2019-10-29 22:04:40 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2019-11-01 08:43:09 +0900
commit60bb1cf942ad0815dcf42cbfe8acd1e076d848cf (patch)
tree3998826b6b78d9f7d3100570aa28aa86f8b040fd /lib/events/accountdataevents.h
parent8a574f8727cc8b1c91acf0840e99c9382c289098 (diff)
downloadlibquotient-60bb1cf942ad0815dcf42cbfe8acd1e076d848cf.tar.gz
libquotient-60bb1cf942ad0815dcf42cbfe8acd1e076d848cf.zip
Derive Omittable<> from std::optional<>
That breaks API all over the place but: 1. The fixes are trivial. 2. More of std:: is used instead of home-baking the same stuff.
Diffstat (limited to 'lib/events/accountdataevents.h')
-rw-r--r--lib/events/accountdataevents.h10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/events/accountdataevents.h b/lib/events/accountdataevents.h
index 31176766..a55016d9 100644
--- a/lib/events/accountdataevents.h
+++ b/lib/events/accountdataevents.h
@@ -1,5 +1,3 @@
-#include <utility>
-
/******************************************************************************
* Copyright (C) 2018 Kitsune Ral <kitsune-ral@users.sf.net>
*
@@ -34,13 +32,13 @@ struct TagRecord {
order_type order;
- TagRecord(order_type order = none) : order(order) {}
+ TagRecord(order_type order = none) : order(std::move(order)) {}
bool operator<(const TagRecord& other) const
{
- // Per The Spec, rooms with no order should be after those with order
- return !order.omitted()
- && (other.order.omitted() || order.value() < other.order.value());
+ // Per The Spec, rooms with no order should be after those with order,
+ // against optional<>::operator<() convention.
+ return order && (!other.order || *order < *other.order);
}
};