You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@mesos.apache.org by "Jie Yu (JIRA)" <ji...@apache.org> on 2016/01/19 00:15:39 UTC

[jira] [Created] (MESOS-4422) Use adaptor::reverse for reverse iteration in the code base.

Jie Yu created MESOS-4422:
-----------------------------

             Summary: Use adaptor::reverse for reverse iteration in the code base.
                 Key: MESOS-4422
                 URL: https://issues.apache.org/jira/browse/MESOS-4422
             Project: Mesos
          Issue Type: Task
            Reporter: Jie Yu


It would be good to be consistent on our looping structure.

Currently, we use foreach for forward iteration and use rbegin/rend for reverse iteration. We recently added adaptor::reverse in stout, which allows us to do:

{noformat}
vector<int> input = {....};
foreach (int i, adaptor::reverse(input)) {
  ...
}
{noformat}

We should cleanup our code to consistently use this structure on reverse iteration.

{noformat}
jie$ grep -R rbegin src
src/common/protobuf_utils.cpp:  for (auto status = task.statuses().rbegin();
src/slave/containerizer/mesos/containerizer.cpp:  for (auto it = isolators.crbegin(); it != isolators.crend(); ++it) {
{noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)