Skip to content

Commit f5c15db

Browse files
committed
#2487: cxx20: explicitly enumerate captures to work with c++17 and 20
1 parent a4c7944 commit f5c15db

File tree

10 files changed

+33
-33
lines changed

10 files changed

+33
-33
lines changed

src/vt/collective/reduce/reduce.impl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ Reduce::PendingSendType Reduce::reduce(
151151
ReduceNumType num_contrib
152152
) {
153153
auto msg_ptr = promoteMsg(msg);
154-
return PendingSendType{theMsg()->getEpochContextMsg(msg_ptr), [=,this](){
154+
return PendingSendType{theMsg()->getEpochContextMsg(msg_ptr), [this, root, msg_ptr, id, num_contrib](){
155155
reduceImmediate<f>(root, msg_ptr.get(), id, num_contrib);
156156
} };
157157
}

src/vt/messaging/active.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1107,7 +1107,7 @@ void ActiveMessenger::finishPendingActiveMsgAsyncRecv(InProgressIRecv* irecv) {
11071107
} else {
11081108
/*bool const put_delivered = */recvDataMsg(
11091109
1, put_tag, sender,
1110-
[=,this](PtrLenPairType ptr, ActionType deleter){
1110+
[this, base, sender](PtrLenPairType ptr, ActionType deleter){
11111111
envelopeSetPutPtr(base->env, std::get<0>(ptr), std::get<1>(ptr));
11121112
processActiveMsg(base, sender, true, deleter);
11131113
}

src/vt/messaging/collection_chain_set.impl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ CollectionChainSet<Index>::CollectionChainSet(
6969
auto const this_node = theContext()->getNode();
7070
auto const proxy_bits = proxy.getProxy();
7171

72-
ListenerType l = [=,this](ElementEventEnum event, IndexT idx, NodeType home) {
72+
ListenerType l = [this, p, layout, this_node](ElementEventEnum event, IndexT idx, NodeType home) {
7373
switch (event) {
7474
case ElementEventEnum::ElementCreated:
7575
case ElementEventEnum::ElementMigratedIn:

src/vt/rdma/rdma.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1289,7 +1289,7 @@ void RDMAManager::createDirectChannelInternal(
12891289
);
12901290

12911291
auto cb = theCB()->makeFunc<GetInfoChannel>(
1292-
pipe::LifetimeEnum::Once, [=,this](GetInfoChannel* msg){
1292+
pipe::LifetimeEnum::Once, [this, type, han, non_target, action, unique_channel_tag, is_target, override_target](GetInfoChannel* msg){
12931293
auto const& my_num_bytes = msg->num_bytes;
12941294
createDirectChannelFinish(
12951295
type, han, non_target, action, unique_channel_tag, is_target, my_num_bytes,
@@ -1326,7 +1326,7 @@ void RDMAManager::removeDirectChannel(
13261326
auto const target = getTarget(han, override_target);
13271327

13281328
if (this_node != target) {
1329-
auto cb = theCB()->makeFunc(pipe::LifetimeEnum::Once, [=,this]{
1329+
auto cb = theCB()->makeFunc(pipe::LifetimeEnum::Once, [this, han, action, target, this_node]{
13301330
auto iter = channels_.find(
13311331
makeChannelLookup(han,RDMA_TypeType::Put,target,this_node)
13321332
);

src/vt/rdmahandle/holder.impl.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ RequestHolder Holder<T,E>::rget(
150150
auto mpi_type_str = TypeMPI<T>::getTypeStr();
151151
RequestHolder r;
152152
if (mpi2_) {
153-
r.add([=,this]{
153+
r.add([this, l, node, ptr, offset, len, mpi_type, mpi_type_str]{
154154
LockMPI _scope_lock(l, node, data_window_);
155155
vt_debug_print(
156156
verbose, rdma,
@@ -188,7 +188,7 @@ RequestHolder Holder<T,E>::rput(
188188
auto mpi_type_str = TypeMPI<T>::getTypeStr();
189189
RequestHolder r;
190190
if (mpi2_) {
191-
r.add([=,this]{
191+
r.add([this, l, node, ptr, offset, len, mpi_type, mpi_type_str]{
192192
LockMPI _scope_lock(l, node, data_window_);
193193
vt_debug_print(
194194
verbose, rdma,
@@ -245,7 +245,7 @@ RequestHolder Holder<T,E>::raccum(
245245
auto mpi_type_str = TypeMPI<T>::getTypeStr();
246246
RequestHolder r;
247247
if (mpi2_) {
248-
r.add([=,this]{
248+
r.add([this, l, node, offset, ptr, len, mpi_type, mpi_type_str, op]{
249249
LockMPI _scope_lock(l, node, data_window_);
250250
vt_debug_print(
251251
verbose, rdma,

src/vt/topos/location/location.impl.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ void EntityLocationCoord<EntityID>::routeMsgNode(
597597

598598
theTerm()->produce(epoch);
599599

600-
auto trigger_msg_handler_action = [=,this](EntityID const& hid) {
600+
auto trigger_msg_handler_action = [this, msg, home_node, epoch](EntityID const& hid) {
601601
bool const& has_handler = msg->hasHandler();
602602
auto const& from = msg->getLocFromNode();
603603
if (has_handler) {
@@ -662,7 +662,7 @@ void EntityLocationCoord<EntityID>::routeMsgNode(
662662

663663
EntityID id_ = id;
664664
// buffer the message here, the entity will be registered in the future
665-
insertPendingEntityAction(id_, [=,this](NodeType resolved) {
665+
insertPendingEntityAction(id_, [this, id_, epoch, msg, home_node, trigger_msg_handler_action](NodeType resolved) {
666666
auto const& my_node = theContext()->getNode();
667667

668668
vt_debug_print(
@@ -779,7 +779,7 @@ void EntityLocationCoord<EntityID>::routePreparedMsg(
779779
} else {
780780
theTerm()->produce(epoch);
781781
// non-eager protocol: get location first then send message after resolution
782-
getLocation(msg->getEntity(), msg->getHomeNode(), [=,this](NodeType node) {
782+
getLocation(msg->getEntity(), msg->getHomeNode(), [this, epoch, msg](NodeType node){
783783
theMsg()->pushEpoch(epoch);
784784
routeMsgNode<MessageT>(
785785
msg->getEntity(), msg->getHomeNode(), node, msg

src/vt/vrt/collection/balance/lb_invoke/lb_manager.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ void LBManager::defaultPostLBWork(ReassignmentMsg* msg) {
186186
auto phase = msg->phase;
187187
auto proposed = std::make_shared<ProposedReassignment>(model_, reassignment);
188188

189-
runInEpochCollective("LBManager::runLB -> computeStats", [=,this] {
189+
runInEpochCollective("LBManager::runLB -> computeStats", [this, proposed, phase] {
190190
auto stats_cb = vt::theCB()->makeBcast<&LBManager::statsHandler>(proxy_);
191191
before_lb_stats_ = false;
192192
computeStatistics(proposed, false, phase, stats_cb);
@@ -228,7 +228,7 @@ void LBManager::defaultPostLBWork(ReassignmentMsg* msg) {
228228

229229
void
230230
LBManager::runLB(PhaseType phase, vt::Callback<ReassignmentMsg> cb) {
231-
runInEpochCollective("LBManager::runLB -> updateLoads", [=,this] {
231+
runInEpochCollective("LBManager::runLB -> updateLoads", [this, phase] {
232232
model_->updateLoads(phase);
233233
});
234234

@@ -241,7 +241,7 @@ LBManager::runLB(PhaseType phase, vt::Callback<ReassignmentMsg> cb) {
241241
);
242242
}
243243

244-
runInEpochCollective("LBManager::runLB -> computeStats", [=,this] {
244+
runInEpochCollective("LBManager::runLB -> computeStats", [this, phase] {
245245
auto stats_cb = vt::theCB()->makeBcast<&LBManager::statsHandler>(proxy_);
246246
before_lb_stats_ = true;
247247
computeStatistics(model_, false, phase, stats_cb);
@@ -327,11 +327,11 @@ void LBManager::startLB(
327327
last_phase_info_->migration_count = 0;
328328
last_phase_info_->ran_lb = false;
329329

330-
runInEpochCollective("LBManager::noLB -> updateLoads", [=,this] {
330+
runInEpochCollective("LBManager::noLB -> updateLoads", [this, phase] {
331331
model_->updateLoads(phase);
332332
});
333333

334-
runInEpochCollective("LBManager::noLB -> computeStats", [=,this] {
334+
runInEpochCollective("LBManager::noLB -> computeStats", [this, phase] {
335335
before_lb_stats_ = true;
336336
auto stats_cb = vt::theCB()->makeBcast<&LBManager::statsHandler>(proxy_);
337337
before_lb_stats_ = true;

src/vt/vrt/collection/manager.impl.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ CollectionManager::runConstructor(Args&&... args) {
127127

128128
template <typename ColT>
129129
void CollectionManager::addCleanupFn(VirtualProxyType proxy) {
130-
cleanup_fns_[proxy].push_back([=,this]{
130+
cleanup_fns_[proxy].push_back([this, proxy]{
131131
CollectionProxyWrapType<ColT> typed_proxy(proxy);
132132
destroyMatching(typed_proxy);
133133
});
@@ -1792,7 +1792,7 @@ MigrateStatus CollectionManager::migrate(
17921792

17931793
auto const epoch = theMsg()->getEpoch();
17941794
theTerm()->produce(epoch);
1795-
schedule([=,this]{
1795+
schedule([this, epoch, col_proxy, idx, dest]{
17961796
theMsg()->pushEpoch(epoch);
17971797
migrateOut<ColT,IndexT>(col_proxy, idx, dest);
17981798
theMsg()->popEpoch(epoch);
@@ -2342,7 +2342,7 @@ messaging::PendingSend CollectionManager::schedule(
23422342
) {
23432343
theTerm()->produce(cur_epoch);
23442344
return messaging::PendingSend(
2345-
msg, [=,this]([[maybe_unused]] MsgVirtualPtr<BaseMsgType> inner_msg
2345+
msg, [this, cur_epoch, action, execute_now]([[maybe_unused]] MsgVirtualPtr<BaseMsgType> inner_msg
23462346
){
23472347
auto fn = [=]{
23482348
theMsg()->pushEpoch(cur_epoch);

tests/unit/termination/test_term_dep_send_chain.cc

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -336,23 +336,23 @@ struct MyObjGroup {
336336
}
337337

338338
void op1() {
339-
chains_->nextStep("op1", [=,this](vt::Index2D idx) {
339+
chains_->nextStep("op1", [this](vt::Index2D idx) {
340340
auto a = calcVal(1, idx);
341341
auto b = calcVal(2, idx);
342342
return backend_proxy_(idx).template send<OpMsg, &MyCol::op1>(a,b);
343343
});
344344
}
345345

346346
void op2() {
347-
chains_->nextStep("op2", [=,this](vt::Index2D idx) {
347+
chains_->nextStep("op2", [this](vt::Index2D idx) {
348348
auto a = calcVal(3,idx);
349349
auto b = calcVal(4,idx);
350350
return backend_proxy_(idx).template send<OpMsg, &MyCol::op2>(a,b);
351351
});
352352
}
353353

354354
void op3() {
355-
chains_->nextStep("op3", [=,this](vt::Index2D idx) {
355+
chains_->nextStep("op3", [this](vt::Index2D idx) {
356356
std::vector<double> v;
357357
for (auto i = 0; i < 10; i++) {
358358
v.push_back(idx.x()*i + idx.y());
@@ -362,7 +362,7 @@ struct MyObjGroup {
362362
}
363363

364364
void op4() {
365-
chains_->nextStep("op4", [=,this](vt::Index2D idx) {
365+
chains_->nextStep("op4", [this](vt::Index2D idx) {
366366
auto node = vt::theContext()->getNode();
367367
auto num = vt::theContext()->getNumNodes();
368368
auto next = node + 1 < num ? node + 1 : 0;
@@ -380,31 +380,31 @@ struct MyObjGroup {
380380
}
381381

382382
void op5() {
383-
chains_->nextStep("op5", [=,this](vt::Index2D idx) {
383+
chains_->nextStep("op5", [this](vt::Index2D idx) {
384384
auto a = calcVal(7,idx);
385385
auto b = calcVal(8,idx);
386386
return backend_proxy_(idx).template send<OpMsg, &MyCol::op5>(a,b);
387387
});
388388
}
389389

390390
void op6() {
391-
chains_->nextStepCollective("op6", [=,this](vt::Index2D idx) {
391+
chains_->nextStepCollective("op6", [this](vt::Index2D idx) {
392392
auto a = calcVal(9,idx);
393393
auto b = calcVal(10,idx);
394394
return backend_proxy_(idx).template send<OpMsg, &MyCol::op6>(a,b);
395395
});
396396
}
397397

398398
void op7() {
399-
chains_->nextStep("op7", [=,this](vt::Index2D idx) {
399+
chains_->nextStep("op7", [this](vt::Index2D idx) {
400400
auto a = calcVal(11,idx);
401401
auto b = calcVal(12,idx);
402402
return backend_proxy_(idx).template send<OpMsg, &MyCol::op7>(a,b);
403403
});
404404
}
405405

406406
void doMigrate() {
407-
chains_->nextStep("doMigrate", [=,this](vt::Index2D idx) {
407+
chains_->nextStep("doMigrate", [this](vt::Index2D idx) {
408408
auto a = calcVal(13,idx);
409409
auto b = calcVal(14,idx);
410410
return backend_proxy_(idx).template send<OpMsg, &MyCol::doMigrate>(a,b);
@@ -422,7 +422,7 @@ struct MyObjGroup {
422422
}
423423

424424
void finalCheck(int i) {
425-
chains_->nextStep("finalCheck", [=,this](vt::Index2D idx) {
425+
chains_->nextStep("finalCheck", [this, i](vt::Index2D idx) {
426426
return backend_proxy_(idx).template send<FinalMsg, &MyCol::finalCheck>(i);
427427
});
428428
}
@@ -607,7 +607,7 @@ struct MergeObjGroup
607607
}
608608

609609
void initData() {
610-
chains_->nextStep("initData", [=,this](vt::Index2D idx) {
610+
chains_->nextStep("initData", [this](vt::Index2D idx) {
611611
auto x = calcVal(1,idx);
612612
return backend_proxy_(idx).template send<MergeCol::DataMsg, &MergeCol::initData>(x);
613613
});
@@ -618,13 +618,13 @@ struct MergeObjGroup
618618
vt::messaging::CollectionChainSet<vt::Index2D>::mergeStepCollective( "interact",
619619
*chains_,
620620
*other.chains_,
621-
[=,this]( vt::Index2D idx) {
621+
[this, other_proxy]( vt::Index2D idx) {
622622
return backend_proxy_(idx).template send<MergeCol::GhostMsg, &MergeCol::ghost>(other_proxy);
623623
});
624624
}
625625

626626
void check( double offset, double other_offset, bool is_left ) {
627-
chains_->nextStep("initData", [=,this](vt::Index2D idx) {
627+
chains_->nextStep("initData", [this, offset, is_left, other_offset](vt::Index2D idx) {
628628
auto x = calcVal(1,idx) + offset;
629629
if ( !is_left )
630630
x *= calcVal(1,idx) + other_offset;

tests/unit/termination/test_termination_action_callable.extended.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ TEST_F(TestTermCallable, test_add_action_unique) /*NOLINT*/{
8686

8787
// assign an arbitrary action to be triggered at
8888
// the end of the epoch and toggle the previous flag.
89-
::vt::theTerm()->addActionEpoch(epoch, [=,this]{
89+
::vt::theTerm()->addActionEpoch(epoch, [this, epoch]{
9090
vt_debug_print(
9191
normal, term,
9292
"current epoch:{:x} finished\n",
@@ -97,7 +97,7 @@ TEST_F(TestTermCallable, test_add_action_unique) /*NOLINT*/{
9797

9898
// assign a callable to be triggered after
9999
// the action submitted for the given epoch.
100-
::vt::theTerm()->addActionUnique(epoch, [=,this]{
100+
::vt::theTerm()->addActionUnique(epoch, [this, epoch]{
101101
vt_debug_print(
102102
normal, term,
103103
"trigger callable for epoch:{:x}\n",

0 commit comments

Comments
 (0)