79788775

Date: 2025-10-12 20:45:51
Score: 1.5
Natty:
Report link

What you want to do is analogous to having a pile of books and wanting to place a new one at the bottom. You’d have to lift the whole pile up, place the new book down, and the pile on top of it.

Now, you’ve changed the position of each book in the original pile by one, so what you’ve done isn’t as nontrivial as putting a book on top of the pile (read push back on a vector). But, you’ve only moved books around without disturbing their contents. So it’s also not all that heavy.

Note that a vector in itself is a light object, essentially just a pointer to an array with bells n whistles. By adding a new vector to the head, you’re just shuffling around these lightweight objects - not the actual content pointed to by the vectors in your super vector.

As to how impactful that would be - this cannot be answered in the abstract, but rather depends on how often you’re doing it along with the idiosyncrasies of your target system. The only way to get a meaningful answer is to profile your code

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Starts with a question (0.5): What you
  • Low reputation (1):
Posted by: Numinous