Chain executor in timeout functions
[folly.git] / folly / Traits.h
index 132e0f2b4a0b9aa73365886f1b5098591bc169f8..309157c4dfadcf952faddc8284bf004f07a401ac 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2014 Facebook, Inc.
+ * Copyright 2015 Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -290,34 +290,6 @@ struct IsOneOf<T, T1, Ts...> {
   enum { value = std::is_same<T, T1>::value || IsOneOf<T, Ts...>::value };
 };
 
-/**
- * A traits class to check for incomplete types.
- *
- * Example:
- *
- *  struct FullyDeclared {}; // complete type
- *  struct ForwardDeclared; // incomplete type
- *
- *  is_complete<int>::value // evaluates to true
- *  is_complete<FullyDeclared>::value // evaluates to true
- *  is_complete<ForwardDeclared>::value // evaluates to false
- *
- *  struct ForwardDeclared {}; // declared, at last
- *
- *  is_complete<ForwardDeclared>::value // now it evaluates to true
- *
- * @author: Marcelo Juchem <marcelo@fb.com>
- */
-template <typename T>
-class is_complete {
-  template <unsigned long long> struct sfinae {};
-  template <typename U>
-  constexpr static bool test(sfinae<sizeof(U)>*) { return true; }
-  template <typename> constexpr static bool test(...) { return false; }
-public:
-  constexpr static bool value = test<T>(nullptr);
-};
-
 /*
  * Complementary type traits for integral comparisons.
  *
@@ -340,6 +312,13 @@ struct is_negative_impl<T, false> {
   constexpr static bool check(T x) { return false; }
 };
 
+// folly::to integral specializations can end up generating code
+// inside what are really static ifs (not executed because of the templated
+// types) that violate -Wsign-compare so suppress them in order to not prevent
+// all calling code from using it.
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wsign-compare"
+
 template <typename RHS, RHS rhs, typename LHS>
 bool less_than_impl(
   typename std::enable_if<
@@ -371,6 +350,8 @@ bool less_than_impl(
   return false;
 }
 
+#pragma GCC diagnostic pop
+
 template <typename RHS, RHS rhs, typename LHS>
 bool greater_than_impl(
   typename std::enable_if<