Skip to content

Deprecate resizeWithReserve of Vector and BitSet - #6967

Merged
Fedr merged 4 commits into
masterfrom
deprecate-auto-resize
Sep 29, 2026
Merged

Fedr merged 4 commits into
masterfrom
deprecate-auto-resize

Conversation

@Fedr

@Fedr Fedr commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Deprecates Vector::resizeWithReserve and BitSet::resizeWithReserve. Their only purpose was to grow the capacity geometrically, but std::vector::resize already does that:

  • libstdc++ at least doubles it, since GCC 3.0;
  • libc++ uses max( 2 * capacity, newSize ), since LLVM 3.0;
  • MSVC STL uses 1.5 × capacity.

So their callers (MeshTopology::vertResizeWithReserve / faceResizeWithReserve, PolylineTopology::vertResizeWithReserve, SurfaceManipulationWidget) now use resize(), and so do autoResizeSet / autoResizeAt, which stay unchanged otherwise.

The deprecated functions stay in the bindings, since mrbind forwards [[deprecated]] (a Python DeprecationWarning, a deprecation attribute in C, [Obsolete] in C#).

Checked locally (MSVC, /WX, C4996 enabled): MRMesh, MRVoxels and MRIOExtras build, and all MRViewer and MRTest sources compile.

🤖 Generated with Claude Code

Fedr and others added 2 commits September 29, 2026 14:06
…t, autoResizeTestSet

std::vector::resize already grows the capacity geometrically in libstdc++, libc++ and MSVC STL,
so the helpers are replaced with plain resize() + set/[]/test_set everywhere.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…heir call sites

Only resizeWithReserve stays deprecated. Up-front sizing (sized constructors, one resize before
a loop) is kept where the final size is known.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Fedr Fedr changed the title Deprecate resizeWithReserve, autoResizeSet, autoResizeAt, autoResizeTestSet of Vector and BitSet Deprecate resizeWithReserve of Vector and BitSet; size bitsets up front where known Sep 29, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Fedr Fedr changed the title Deprecate resizeWithReserve of Vector and BitSet; size bitsets up front where known Deprecate resizeWithReserve of Vector and BitSet Sep 29, 2026
@Fedr
Fedr merged commit 5ec776c into master Sep 29, 2026
58 checks passed
@Fedr
Fedr deleted the deprecate-auto-resize branch September 29, 2026 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants