VisualObject: do not include MRVector.h, MRMeshTexture.h and MRIRenderObject.h - #6818
Merged
Merged
Conversation
The header uses neither Vector nor MeshTexture; the files that were getting them (and MRHeapBytes.h through MRImage.h) transitively now include what they use.
IRenderObject is only needed for the renderObj_ member; forward declarations suffice once the special members are out of line, which dllexport requires.
GCC 12 reports a false -Wstringop-overflow inside std::operator+( string&&, string&& ) once it inlines it here; appending avoids that code path.
Grantim
approved these changes
Sep 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MRVisualObject.hstops includingMRVector.h,MRMeshTexture.handMRIRenderObject.h. It mentions neitherVectornorMeshTextureat all, and needsIRenderObjectand the render-param structs only for a member and for by-reference parameters, so those are forward-declared inMRMeshFwd.hinstead.VisualObjects move constructor, protected copy constructor, move assignment and destructor move out of line. This is what makes the incompleteIRenderObjectacceptable:MRMESH_CLASSis__declspec(dllexport)while building MRMesh, and MSVC emits every defaulted special member of a dllexported class, which instantiatesunique_ptr<IRenderObject>::~unique_ptrand static-asserts on the incomplete type. It is not specific toMRUniquePtr.h- a plainstd::unique_ptr<Incomplete>member behaves identically; a 25-line repro compiles withdllimportand fails withdllexport, and passes again once the special members are declared out of line.The files that were relying on the transitive includes now include what they use:
MRIRenderObject.hin the 16 files callingcreateRenderObject()or dereferencingrenderObj_, plusMRRenderWrapObject.h;MRVector.hin the two headers with aVertColorsmember;MRMeshTexture.hin the four files usingMeshTexture;MRHeapBytes.hin 22 files that callMR::heapBytes()in inline bodies and were getting it viaMRMeshTexture.h->MRImage.h;<typeindex>inMRVisualObject.hitself, for thestd::type_indexmember ofAnyVisualizeMaskEnum.Verified with a
cl /Zssweep of MRMesh, MRViewer, MRVoxels and MRSymbolMesh: failing-TU sets identical to the same sweep on master (4 known no-PCH artifacts in MRMesh, 82 in MRViewer, 0 elsewhere), and MRMesh.dll links, which exercises the four new out-of-line definitions. The include-graph pass reports no remaining user of the dropped headers and no std header lost.