constexpr the Unit comparison ops
authorEric Niebler <eniebler@fb.com>
Mon, 3 Jul 2017 21:13:27 +0000 (14:13 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Mon, 3 Jul 2017 21:22:58 +0000 (14:22 -0700)
Summary: `constexpr` All The Things!

Reviewed By: Orvid

Differential Revision: D5364910

fbshipit-source-id: 11abeb8adc38aef3ac4f2596ecf0f533b9e74203

folly/Unit.h

index cfc2703b0437eedfdd49d4a04352b9e88b05d78b..0f90ff6e40f8b7669307b6a67ff66659906033b1 100644 (file)
@@ -45,8 +45,12 @@ struct Unit {
   template <typename T>
   struct Drop : std::conditional<std::is_same<T, Unit>::value, void, T> {};
 
-  bool operator==(const Unit& /*other*/) const { return true; }
-  bool operator!=(const Unit& /*other*/) const { return false; }
+  constexpr bool operator==(const Unit& /*other*/) const {
+    return true;
+  }
+  constexpr bool operator!=(const Unit& /*other*/) const {
+    return false;
+  }
 };
 
 constexpr Unit unit {};