From 60bb1cf942ad0815dcf42cbfe8acd1e076d848cf Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Tue, 29 Oct 2019 22:04:40 +0900 Subject: 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. --- lib/events/accountdataevents.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'lib/events/accountdataevents.h') 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 - /****************************************************************************** * Copyright (C) 2018 Kitsune Ral * @@ -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); } }; -- cgit v1.2.3