3 ms·
If your object is in a vector, it's already possible for the vector to move the object without updating any pointers to it. The only question is whether it is
by dreiss 14y ago
If your object is in a vector, it's already possible for the vector to move the object without updating any pointers to it. The only question is whether it is safe for the vector to move the object with memmove instead of invoking a copy/move constructor, essentially skipping the step of telling the object that it is being moved. This will only fail if the object contains pointers to its own sub-objects (or the move constructor updates external pointers). This is fairly rare, especially for objects that you would store directly in a vector.
std::string is a key exception to this, but fbstring is not.
- chasingtheflow 14y agoCould you elaborate at all on what it means to put an object in a vector/why you would want to do that?