folly: avoid compile warning/failure due to lvalue-to-rvalue conversion
[folly.git] / folly / io / async / DelayedDestructionBase.h
index 52505a064c892c69adcc4fb63524f0f73ace560e..9375baa0ce266388a8827f19c357b95c3b0e2bdd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 Facebook, Inc.
+ * Copyright 2017 Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 
 #include <assert.h>
 #include <cstddef>
+#include <cstdint>
+#include <functional>
 #include <memory>
 #include <type_traits>
 #include <utility>
+
 #include <boost/noncopyable.hpp>
-#include <functional>
 #include <glog/logging.h>
-#include <inttypes.h>
 
 namespace folly {
 
@@ -246,25 +247,25 @@ inline bool operator !=(
     const DelayedDestructionBase::DestructorGuard& right) {
   return left.get() != right.get();
 }
-inline bool operator ==(
+inline bool operator==(
     const DelayedDestructionBase::DestructorGuard& left,
-    std::nullptr_t right) {
-  return left.get() == right;
+    std::nullptr_t) {
+  return left.get() == nullptr;
 }
-inline bool operator ==(
-    std::nullptr_t left,
+inline bool operator==(
+    std::nullptr_t,
     const DelayedDestructionBase::DestructorGuard& right) {
-  return left == right.get();
+  return nullptr == right.get();
 }
-inline bool operator !=(
+inline bool operator!=(
     const DelayedDestructionBase::DestructorGuard& left,
-    std::nullptr_t right) {
-  return left.get() != right;
+    std::nullptr_t) {
+  return left.get() != nullptr;
 }
-inline bool operator !=(
-    std::nullptr_t left,
+inline bool operator!=(
+    std::nullptr_t,
     const DelayedDestructionBase::DestructorGuard& right) {
-  return left != right.get();
+  return nullptr != right.get();
 }
 
 template <typename LeftAliasType, typename RightAliasType>
@@ -280,27 +281,27 @@ inline bool operator !=(
   return left.get() != right.get();
 }
 template <typename LeftAliasType>
-inline bool operator ==(
+inline bool operator==(
     const DelayedDestructionBase::IntrusivePtr<LeftAliasType>& left,
-    std::nullptr_t right) {
-  return left.get() == right;
+    std::nullptr_t) {
+  return left.get() == nullptr;
 }
 template <typename RightAliasType>
-inline bool operator ==(
-    std::nullptr_t left,
+inline bool operator==(
+    std::nullptr_t,
     const DelayedDestructionBase::IntrusivePtr<RightAliasType>& right) {
-  return left == right.get();
+  return nullptr == right.get();
 }
 template <typename LeftAliasType>
-inline bool operator !=(
+inline bool operator!=(
     const DelayedDestructionBase::IntrusivePtr<LeftAliasType>& left,
-    std::nullptr_t right) {
-  return left.get() != right;
+    std::nullptr_t) {
+  return left.get() != nullptr;
 }
 template <typename RightAliasType>
-inline bool operator !=(
-    std::nullptr_t left,
+inline bool operator!=(
+    std::nullptr_t,
     const DelayedDestructionBase::IntrusivePtr<RightAliasType>& right) {
-  return left != right.get();
+  return nullptr != right.get();
 }
-} // folly
+} // namespace folly