jverce commented on a change in pull request #12356: [MXNET-860] Use modernized 
ranged loops where possible
URL: https://github.com/apache/incubator-mxnet/pull/12356#discussion_r222742760
 
 

 ##########
 File path: src/imperative/cached_op.cc
 ##########
 @@ -784,7 +784,7 @@ OpStatePtr CachedOp::DynamicForward(
   states.reserve(idx.num_nodes());
   std::vector<NDArray*> arrays;
   arrays.reserve(buff.size());
-  for (size_t i = 0; i < buff.size(); ++i) arrays.push_back(&buff[i]);
+  for (auto& i : buff) arrays.push_back(&i);
 
 Review comment:
   I'd change it to `const auto& item : buff` to avoid confusing `i` with an 
index var (like in the loop below)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to