folly::Init, RAII variant of folly::init
[folly.git] / folly / Unit.h
index f1c71618894b0920aff61a7f4fd1ca9724c6834f..52f38fcfaf3caaa325bae8810b89b76c21bfd124 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.
@@ -43,12 +43,20 @@ struct Unit {
   template <typename T>
   struct Lift : std::conditional<std::is_same<T, void>::value, Unit, T> {};
   template <typename T>
+  using LiftT = typename Lift<T>::type;
+  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; }
+  template <typename T>
+  using DropT = typename Drop<T>::type;
+
+  constexpr bool operator==(const Unit& /*other*/) const {
+    return true;
+  }
+  constexpr bool operator!=(const Unit& /*other*/) const {
+    return false;
+  }
 };
 
 constexpr Unit unit {};
 
-}
+} // namespace folly