HomePhabricator

Fix a subtle issue in SmallVector. The following code did not work as expected:
rL134554Unpublished

Unpublished Commit ยท Learn More

No further details are available.

Description

Fix a subtle issue in SmallVector. The following code did not work as expected:

vec.insert(vec.begin(), vec[3]);

The issue was that vec[3] returns a reference into the vector, which is invalidated when insert() memmove's the elements down to make space. The method needs to specifically detect and handle this case to correctly match std::vector's semantics.

Thanks to Howard Hinnant for clarifying the correct behavior, and explaining how std::vector solves this problem.

Details

Committed
resistorJul 6 2011, 3:36 PM
Parents
rL134553: SWIG doesn't need two methods of the same name 'GetDescription' but differ in
Branches
Unknown
Tags
Unknown