Index: base/containers/flat_map.h |
diff --git a/base/containers/flat_map.h b/base/containers/flat_map.h |
index e2cb003338c5fb8171487b61a3676dc0cf7c7fa5..eeff38b29991c87e17728125763d515bf008d293 100644 |
--- a/base/containers/flat_map.h |
+++ b/base/containers/flat_map.h |
@@ -38,6 +38,15 @@ struct GetKeyFromValuePairFirst { |
// flat_tree.h for more details for most of these functions. As a quick |
// reference, the functions available are: |
// |
+// Constructors (inputs need not be sorted, first of duplicates will be kept): |
+// flat_map(InputIterator first, InputIterator last, |
+// const Compare& compare = Compare()); |
+// flat_map(const flat_map&); |
+// flat_map(flat_map&&); |
+// flat_map(std::vector<value_type>&&); |
+// flat_map(std::initializer_list<value_type> ilist, |
+// const Compare& comp = Compare()); |
+// |
// Assignment functions: |
// flat_map& operator=(const flat_map&); |
// flat_map& operator=(flat_map&&); |
@@ -95,7 +104,7 @@ struct GetKeyFromValuePairFirst { |
// iterator upper_bound(const Key&); |
// const_iterator upper_bound(const Key&) const; |
// |
-// General functions |
+// General functions: |
// void swap(flat_map&&) |
// |
// Non-member operators: |
@@ -134,11 +143,14 @@ class flat_map : public ::base::internal::flat_tree< |
// duplicates an arbitrary one will be chosen. |
// |
// Assume that move constructors invalidate iterators and references. |
+ // |
+ // The constructors that take ranges, lists, and vectors do not require that |
+ // the input be sorted. If there are duplcates, the first one in the input |
+ // will be selected. |
flat_map(); |
explicit flat_map(const Compare& comp); |
- // Not stable in the presence of duplicates in the initializer list. |
template <class InputIterator> |
flat_map(InputIterator first, |
InputIterator last, |
@@ -147,7 +159,9 @@ class flat_map : public ::base::internal::flat_tree< |
flat_map(const flat_map&); |
flat_map(flat_map&&); |
- // Not stable in the presence of duplicates in the initializer list. |
+ flat_map(std::vector<value_type>&& items, |
dyaroshev
2017/03/31 07:46:52
Accept by value and mke it explicit please.
|
+ const key_compare& comp = key_compare()); |
+ |
flat_map(std::initializer_list<value_type> ilist, |
const Compare& comp = Compare()); |
@@ -208,6 +222,12 @@ flat_map<Key, Mapped, Compare>::flat_map(flat_map&&) = default; |
template <class Key, class Mapped, class Compare> |
flat_map<Key, Mapped, Compare>::flat_map( |
+ std::vector<value_type>&& items, |
+ const key_compare& comp = key_compare()) |
+ : tree(std::move(items), comp) {} |
+ |
+template <class Key, class Mapped, class Compare> |
+flat_map<Key, Mapped, Compare>::flat_map( |
std::initializer_list<value_type> ilist, |
const Compare& comp) |
: flat_map(std::begin(ilist), std::end(ilist), comp) {} |