summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Stolley <colin.stolley@mongodb.com>2022-09-21 16:11:43 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-09-21 17:31:13 +0000
commit286384225a4fae6a2b209e36ee3d5c443ee44972 (patch)
tree3b99a901f403ca84dc4472c204981e7fa5aa4358
parent3aa324accc64c532f53983258b4c7624b0b0158c (diff)
downloadmongo-286384225a4fae6a2b209e36ee3d5c443ee44972.tar.gz
SERVER-69807 Convert std::bind() calls to lambdas.
-rw-r--r--src/mongo/db/query/ce/ce_interpolation_test.cpp3
-rw-r--r--src/mongo/db/query/sbe_stage_builder_filter.cpp46
2 files changed, 27 insertions, 22 deletions
diff --git a/src/mongo/db/query/ce/ce_interpolation_test.cpp b/src/mongo/db/query/ce/ce_interpolation_test.cpp
index d647ce293a6..043d9074b10 100644
--- a/src/mongo/db/query/ce/ce_interpolation_test.cpp
+++ b/src/mongo/db/query/ce/ce_interpolation_test.cpp
@@ -39,8 +39,7 @@ namespace {
using namespace sbe;
double estimateIntValCard(const ScalarHistogram& hist, const int v, const EstimationType type) {
- const auto [tag, val] =
- std::make_pair(value::TypeTags::NumberInt64, value::bitcastFrom<int64_t>(v));
+ auto [tag, val] = std::make_pair(value::TypeTags::NumberInt64, value::bitcastFrom<int64_t>(v));
return estimate(hist, tag, val, type).card;
};
diff --git a/src/mongo/db/query/sbe_stage_builder_filter.cpp b/src/mongo/db/query/sbe_stage_builder_filter.cpp
index 88bc449d7bf..c81b4d246c9 100644
--- a/src/mongo/db/query/sbe_stage_builder_filter.cpp
+++ b/src/mongo/db/query/sbe_stage_builder_filter.cpp
@@ -1262,7 +1262,7 @@ public:
"Eval frame's input slot is not defined",
_context->evalStack.topFrame().data().inputSlot);
auto childInputSlot = *_context->evalStack.topFrame().data().inputSlot;
- auto [filterSlot, filterStage] = [&]() {
+ auto filterPair = [&]() {
auto [expr, stage] = _context->evalStack.popFrame();
auto [predicateSlot, predicateStage] = projectEvalExpr(std::move(expr),
std::move(stage),
@@ -1281,13 +1281,16 @@ public:
// We're using 'kDoNotTraverseLeaf' traverse mode, so we're guaranteed that 'makePredicate'
// will only be called once, so it's safe to bind the reference to 'filterStage' subtree
// here.
- auto makePredicate = std::bind(&elemMatchMakePredicate,
- _context,
- filterSlot,
- std::ref(filterStage),
- childInputSlot,
- _1,
- _2);
+ auto makePredicate =
+ [this, filterSlot = filterPair.first, &filterStage = filterPair.second, childInputSlot](
+ sbe::value::SlotId&& inputSlot, EvalStage&& inputStage) {
+ return elemMatchMakePredicate(_context,
+ filterSlot,
+ filterStage,
+ childInputSlot,
+ std::forward<sbe::value::SlotId>(inputSlot),
+ std::forward<EvalStage>(inputStage));
+ };
// 'makePredicate' defined above returns a state instead of plain boolean value, so there is
// no need to use combinator for it.
@@ -1324,22 +1327,25 @@ public:
_context->state.slotIdGenerator,
_context->stateHelper);
- sbe::value::SlotId filterSlot;
- std::tie(filterSlot, filterStage) = projectEvalExpr(std::move(filterExpr),
- std::move(filterStage),
- _context->planNodeId,
- _context->state.slotIdGenerator);
+ auto filterPair = projectEvalExpr(std::move(filterExpr),
+ std::move(filterStage),
+ _context->planNodeId,
+ _context->state.slotIdGenerator);
// We're using 'kDoNotTraverseLeaf' traverse mode, so we're guaranteed that 'makePredcate'
// will only be called once, so it's safe to bind the reference to 'filterStage' subtree
// here.
- auto makePredicate = std::bind(&elemMatchMakePredicate,
- _context,
- filterSlot,
- std::ref(filterStage),
- childInputSlot,
- _1,
- _2);
+ auto makePredicate =
+ [this, filterSlot = filterPair.first, &filterStage = filterPair.second, childInputSlot](
+ sbe::value::SlotId&& inputSlot, EvalStage&& inputStage) {
+ return elemMatchMakePredicate(_context,
+ filterSlot,
+ filterStage,
+ childInputSlot,
+ std::forward<sbe::value::SlotId>(inputSlot),
+ std::forward<EvalStage>(inputStage));
+ };
+
// 'makePredicate' defined above returns a state instead of plain boolean value, so there is
// no need to use combinator for it.