Skip to content

remove empty destructors so waypoints can be moved#7518

Merged
Goober5000 merged 1 commit into
scp-fs2open:masterfrom
Goober5000:cleanpup/waypoint_move
Jun 16, 2026
Merged

remove empty destructors so waypoints can be moved#7518
Goober5000 merged 1 commit into
scp-fs2open:masterfrom
Goober5000:cleanpup/waypoint_move

Conversation

@Goober5000

Copy link
Copy Markdown
Contributor

A user-declared destructor, even an empty one, suppresses the implicit move operations, so waypoint and waypoint_list were silently copy-only: every Waypoint_lists erase, insert, and reallocation deep-copied entire lists, and inserting a waypoint mid-path copied every shifted waypoint. Removing the destructors restores the implicit moves (correct and noexcept, since the members are vec3d/int and SCP_vector/SCP_string), turning those shifts into pointer steals. The implicit deep copies remain available and unchanged. Waypoint identity is index-encoded in Objects[].instance and renumbered on insert/erase, so relocation semantics are unaffected.

A user-declared destructor, even an empty one, suppresses the implicit
move operations, so waypoint and waypoint_list were silently copy-only:
every Waypoint_lists erase, insert, and reallocation deep-copied entire
lists, and inserting a waypoint mid-path copied every shifted waypoint.
Removing the destructors restores the implicit moves (correct and
noexcept, since the members are vec3d/int and SCP_vector/SCP_string),
turning those shifts into pointer steals.  The implicit deep copies
remain available and unchanged.  Waypoint identity is index-encoded in
Objects[].instance and renumbered on insert/erase, so relocation
semantics are unaffected.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Goober5000 Goober5000 added the cleanup A modification or rewrite of code to make it more understandable or easier to maintain. label Jun 12, 2026
@Goober5000 Goober5000 merged commit a7a2b9c into scp-fs2open:master Jun 16, 2026
20 checks passed
@Goober5000 Goober5000 deleted the cleanpup/waypoint_move branch June 16, 2026 03:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleanup A modification or rewrite of code to make it more understandable or easier to maintain.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants