folly: install missing headers from Makefile.am
[folly.git] / folly / sorted_vector_types.h
index dd091b76347da431486175e7a4b9ad8c7263fcd8..6d29a101fd9d4e9e68465e130c32beb4652a2b13 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2012 Facebook, Inc.
+ * Copyright 2014 Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 #ifndef FOLLY_SORTED_VECTOR_TYPES_H_
 #define FOLLY_SORTED_VECTOR_TYPES_H_
 
-#include <vector>
 #include <algorithm>
-#include <utility>
+#include <initializer_list>
 #include <iterator>
+#include <utility>
+#include <vector>
 #include <boost/operators.hpp>
 #include <boost/bind.hpp>
 #include <boost/type_traits/is_same.hpp>
@@ -214,6 +215,15 @@ public:
     insert(first, last);
   }
 
+  explicit sorted_vector_set(
+      std::initializer_list<value_type> list,
+      const Compare& comp = Compare(),
+      const Allocator& alloc = Allocator())
+    : m_(comp, alloc)
+  {
+    insert(list.begin(), list.end());
+  }
+
   key_compare key_comp() const { return m_; }
   value_compare value_comp() const { return m_; }
 
@@ -440,6 +450,15 @@ public:
     insert(first, last);
   }
 
+  explicit sorted_vector_map(
+      std::initializer_list<value_type> list,
+      const Compare& comp = Compare(),
+      const Allocator& alloc = Allocator())
+    : m_(value_compare(comp), alloc)
+  {
+    insert(list.begin(), list.end());
+  }
+
   key_compare key_comp() const { return m_; }
   value_compare value_comp() const { return m_; }
 
@@ -515,7 +534,7 @@ public:
     return end();
   }
 
-  size_type count(const key_type& key) {
+  size_type count(const key_type& key) const {
     return find(key) == end() ? 0 : 1;
   }