Browse Source

Capture the loop counter by copy, not reference

Ian Goldberg 1 year ago
parent
commit
0ef40dbb69
2 changed files with 2 additions and 2 deletions
  1. 1 1
      duoram.tcc
  2. 1 1
      mpcops.cpp

+ 1 - 1
duoram.tcc

@@ -200,7 +200,7 @@ void Duoram<T>::Flat::butterfly(address_t start, nbits_t depth, bool dir)
     address_t halfwidth = address_t(1)<<(depth-1);
     std::vector<coro_t> coroutines;
     for (address_t i=0; i<halfwidth;++i) {
-        coroutines.emplace_back([&](yield_t &yield) {
+        coroutines.emplace_back([&, i](yield_t &yield) {
             Flat Acoro = context(yield);
             Acoro.osort(start+i, start+i+halfwidth, dir);
         });

+ 1 - 1
mpcops.cpp

@@ -190,7 +190,7 @@ void mpc_xs_to_as(MPCTIO &tio, yield_t &yield,
     std::vector<coro_t> coroutines;
     for (nbits_t i=0; i<nbits-1; ++i) {
         coroutines.emplace_back(
-            [&](yield_t &yield) {
+            [&, i](yield_t &yield) {
                 mpc_valuemul(tio, yield, as_bitand[i], (xs_x.xshare>>i)&1, nbits);
             });
     }