summaryrefslogtreecommitdiff
path: root/src/mongo/bson/bson_comparator_interface_base.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/bson/bson_comparator_interface_base.h')
-rw-r--r--src/mongo/bson/bson_comparator_interface_base.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mongo/bson/bson_comparator_interface_base.h b/src/mongo/bson/bson_comparator_interface_base.h
index f70bec7b872..29d80916f72 100644
--- a/src/mongo/bson/bson_comparator_interface_base.h
+++ b/src/mongo/bson/bson_comparator_interface_base.h
@@ -28,9 +28,11 @@
#pragma once
+#include <boost/container/flat_set.hpp>
#include <initializer_list>
#include <map>
#include <set>
+#include <vector>
#include "mongo/base/disallow_copying.h"
#include "mongo/base/string_data_comparator_interface.h"
@@ -51,6 +53,9 @@ class BSONComparatorInterfaceBase {
MONGO_DISALLOW_COPYING(BSONComparatorInterfaceBase);
public:
+ BSONComparatorInterfaceBase(BSONComparatorInterfaceBase&& other) = default;
+ BSONComparatorInterfaceBase& operator=(BSONComparatorInterfaceBase&& other) = default;
+
/**
* A deferred comparison between two objects of type T, which can be converted into a boolean
* via the evaluate() method.
@@ -122,6 +127,8 @@ public:
using Set = std::set<T, LessThan>;
+ using FlatSet = boost::container::flat_set<T, LessThan>;
+
using UnorderedSet = stdx::unordered_set<T, Hasher, EqualTo>;
template <typename ValueType>
@@ -207,6 +214,10 @@ protected:
return Set(init, LessThan(this));
}
+ FlatSet makeFlatSet(const std::vector<T>& elements) const {
+ return FlatSet(elements.begin(), elements.end(), LessThan(this));
+ }
+
UnorderedSet makeUnorderedSet(std::initializer_list<T> init = {}) const {
return UnorderedSet(init, 0, Hasher(this), EqualTo(this));
}