----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/33271/#review84597 -----------------------------------------------------------
docs/mesos-c++-style-guide.md <https://reviews.apache.org/r/33271/#comment135930> I would like the example mentioned here to be one where the alias we create ends up being a dangling reference because of invalidation. ``` #include <cassert> #include <iostream> #include <memory> #include <vector> int main() { std::vector<std::unique_ptr<int>> vec; vec.reserve(1); assert(vec.capacity() == 1); vec.emplace_back(new int(1)); // Give it a better name than vec[0]. const std::unique_ptr<int>& elem = vec[0]; // Invalidated because we're going over capacity! vec.emplace_back(new int(2)); // Try to use the alias, we segfault here. std::cout << *elem << std::endl; } ``` - Michael Park On May 20, 2015, 9:28 p.m., Joris Van Remoortere wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/33271/ > ----------------------------------------------------------- > > (Updated May 20, 2015, 9:28 p.m.) > > > Review request for mesos, Bernd Mathiske, Cody Maloney, Joerg Schad, Michael > Park, and Till Toenshoff. > > > Bugs: MESOS-2629 > https://issues.apache.org/jira/browse/MESOS-2629 > > > Repository: mesos > > > Description > ------- > > Follow up from r32630. > > > Diffs > ----- > > docs/mesos-c++-style-guide.md 13312f6f4fe1788791479bd768f60df0a8e80e69 > > Diff: https://reviews.apache.org/r/33271/diff/ > > > Testing > ------- > > > Thanks, > > Joris Van Remoortere > >
