Uploaded image for project: 'Mesos'
  1. Mesos
  2. MESOS-4422

Use adaptor::reverse for reverse iteration in the code base.

    XMLWordPrintableJSON

Details

    • Task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • None
    • None
    • None

    Description

      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 (https://reviews.apache.org/r/42450) in stout, which allows us to do:

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

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

      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) {
      

      Attachments

        Activity

          People

            haosdent@gmail.com haosdent
            jieyu Jie Yu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: