summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Ignatyev <alexander.ignatyev@mongodb.com>2021-09-17 20:02:41 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-09-17 20:28:49 +0000
commit12f248b8498e0fcea14322894aad1ebb505beab5 (patch)
treef05dec5edc9f9475457a7dc2214a8f419267784e
parent7e5e6088eaf3ff2e01740cb52efa16c1fb8d360b (diff)
downloadmongo-12f248b8498e0fcea14322894aad1ebb505beab5.tar.gz
SERVER-59331 Fix SBE size_estimator build on macOS
-rw-r--r--src/mongo/db/exec/sbe/size_estimator.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mongo/db/exec/sbe/size_estimator.h b/src/mongo/db/exec/sbe/size_estimator.h
index b5dafdb68da..a69f3db60ff 100644
--- a/src/mongo/db/exec/sbe/size_estimator.h
+++ b/src/mongo/db/exec/sbe/size_estimator.h
@@ -120,6 +120,13 @@ size_t estimate(const std::vector<T, A>& vector) {
return size;
}
+// Overload of 'estimate' function for std::vector<bool> since
+// the latter is often an optimized specialization of std::vector for bool
+// and it might fail to match against ordinary 'size_t estimate(const std::vector<T, A>&)'.
+inline size_t estimate(const std::vector<bool>& vec) {
+ return vec.capacity() * sizeof(bool);
+}
+
template <typename T, typename A>
size_t estimateContainerOnly(const std::vector<T, A>& vector) {
return vector.capacity() * sizeof(T);