Ensure that vector is initialized before setting vector as output of std::transform

XMLWordPrintableJSON

    • Fully Compatible
    • ALL
    • Sharding 2020-10-19
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      There are a few valid ways to output to a newly declared vector from std::transform. For example:

      1. Initialize the vector to the size of the input, so that std::transform can properly index into each memory space, OR
      2. Use std::back_inserter, which is an iterator that will call push_back on the output vector for each input element.

      If one attempts to use std::transform on an uninitialized vector without using std::back_inserter, std::transform will induce a segfault attempting to index into memory that hasn't yet been allocated.

      This ticket is to fix an instance of that bug in Resharding code.

              Assignee:
              Blake Oler
              Reporter:
              Blake Oler
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: