4 ms·
> Yeah I learned that the hard way when I found out that std::vector apparently feels free to move your objects around in memory for you, no matter if you point
by rualca 5y ago
> Yeah I learned that the hard way when I found out that std::vector apparently feels free to move your objects around in memory for you, no matter if you point to them from somewhere else.
It's not as much as "feeling free" as it is having to reallocate the array because you added elements beyond it's capacity and they had to be stored somewhere.
- contravariant 5y agoWell the problem I had was that I apparently didn't forbid it from using the move constructor, after I changed that it correctly failed to compile. So in my case the problem was very much that it took the liberty of doing something I wasn't expecting it to.