Use ReadMostlyMainPtrDeleter in folly::Singleton
[folly.git] / folly / sorted_vector_types.h
index aa2f0420b360283cdb397b49e16d6473842f3aa7..18540185a064ea5c19513bde5c9f26c986eddb89 100644 (file)
 #include <algorithm>
 #include <initializer_list>
 #include <iterator>
+#include <stdexcept>
+#include <type_traits>
 #include <utility>
 #include <vector>
+
 #include <boost/operators.hpp>
-#include <boost/bind.hpp>
-#include <boost/type_traits/is_same.hpp>
 
 namespace folly {
 
@@ -105,7 +106,7 @@ namespace detail {
   template<class Iterator>
   int distance_if_multipass(Iterator first, Iterator last) {
     typedef typename std::iterator_traits<Iterator>::iterator_category categ;
-    if (boost::is_same<categ,std::input_iterator_tag>::value)
+    if (std::is_same<categ,std::input_iterator_tag>::value)
       return -1;
     return std::distance(first, last);
   }
@@ -419,10 +420,7 @@ public:
   typedef std::pair<key_type,mapped_type>           value_type;
   typedef Compare                                   key_compare;
 
-  struct value_compare
-    : std::binary_function<value_type,value_type,bool>
-    , private Compare
-  {
+  struct value_compare : private Compare {
     bool operator()(const value_type& a, const value_type& b) const {
       return Compare::operator()(a.first, b.first);
     }
@@ -573,25 +571,33 @@ public:
 
   iterator lower_bound(const key_type& key) {
     auto c = key_comp();
-    auto f = [&](const auto& a, const auto& b) { return c(a.first, b); };
+    auto f = [&](const value_type& a, const key_type& b) {
+      return c(a.first, b);
+    };
     return std::lower_bound(begin(), end(), key, f);
   }
 
   const_iterator lower_bound(const key_type& key) const {
     auto c = key_comp();
-    auto f = [&](const auto& a, const auto& b) { return c(a.first, b); };
+    auto f = [&](const value_type& a, const key_type& b) {
+      return c(a.first, b);
+    };
     return std::lower_bound(begin(), end(), key, f);
   }
 
   iterator upper_bound(const key_type& key) {
     auto c = key_comp();
-    auto f = [&](const auto& a, const auto& b) { return c(a, b.first); };
+    auto f = [&](const key_type& a, const value_type& b) {
+      return c(a, b.first);
+    };
     return std::upper_bound(begin(), end(), key, f);
   }
 
   const_iterator upper_bound(const key_type& key) const {
     auto c = key_comp();
-    auto f = [&](const auto& a, const auto& b) { return c(a, b.first); };
+    auto f = [&](const key_type& a, const value_type& b) {
+      return c(a, b.first);
+    };
     return std::upper_bound(begin(), end(), key, f);
   }
 
@@ -601,7 +607,9 @@ public:
     // have to do this.
     iterator low = lower_bound(key);
     auto c = key_comp();
-    auto f = [&](const auto& a, const auto& b) { return c(a, b.first); };
+    auto f = [&](const key_type& a, const value_type& b) {
+      return c(a, b.first);
+    };
     iterator high = std::upper_bound(low, end(), key, f);
     return std::make_pair(low, high);
   }