From: Pawel Wasowski Date: Thu, 20 Feb 2020 11:52:15 +0000 (+0100) Subject: [common][optional] Add operator== X-Git-Tag: accepted/tizen/unified/20200326.215035~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F31%2F225531%2F5;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [common][optional] Add operator== Verification: the compilation doesn't fail; further validation will be done when the operator will be used in the UUID class code Change-Id: If7bee4f1f4b5d994aeaa11d32e2e2371397e94ba Signed-off-by: Pawel Wasowski --- diff --git a/src/common/optional.h b/src/common/optional.h index b6b2800..f476eb0 100644 --- a/src/common/optional.h +++ b/src/common/optional.h @@ -147,6 +147,14 @@ class optional { ALIGNAS_TYPE(T) char value_[sizeof(T)]; }; +template +constexpr bool operator==(const optional& a, const optional& b) { + if (a && b) { + return *a == *b; + } + return !a && !b; +} + } // namespace common #undef ALIGNAS_TYPE