From: Kefu Chai Date: Tue, 26 Jul 2022 00:13:22 +0000 (+0800) Subject: common/static_ptr: make free operator==() a member X-Git-Tag: v18.0.0~366^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f987a841d779dacb0fb9f945d0d32000be9738ac;p=ceph.git common/static_ptr: make free operator==() a member since operator==() is now considered commutative in C++20, we can make it a member function. Signed-off-by: Kefu Chai --- diff --git a/src/common/static_ptr.h b/src/common/static_ptr.h index 2091c6cf4d60..31df4cf0a3ca 100644 --- a/src/common/static_ptr.h +++ b/src/common/static_ptr.h @@ -166,6 +166,11 @@ public: return *this; } + + bool operator ==(std::nullptr_t) const { + return !operate; + } + // In-place construction! // // This is basically what you want, and I didn't include value @@ -325,15 +330,6 @@ static_ptr resize_pointer_cast(static_ptr&& p) { return r; } -template -bool operator ==(const static_ptr& s, std::nullptr_t) { - return !s; -} -template -bool operator ==(static_ptr& s, std::nullptr_t) { - return !s; -} - // Since `make_unique` and `make_shared` exist, we should follow their // lead. //