Foundation Classes - Implement move semantics for math_Matrix and math_Vector#841
Merged
dpasukhi merged 3 commits intoOpen-Cascade-SAS:IRfrom Nov 24, 2025
Merged
Conversation
Member
dpasukhi
commented
Nov 19, 2025
- Added move constructors and move assignment operators for math_Matrix and math_Vector classes to optimize resource management.
- Enhanced tests for move semantics to validate behavior with both large and small matrices/vectors.
- Ensured proper handling of source state after moves, including dimension mismatch scenarios.
…h_Vector - Added move constructors and move assignment operators for math_Matrix and math_Vector classes to optimize resource management. - Enhanced tests for move semantics to validate behavior with both large and small matrices/vectors. - Ensured proper handling of source state after moves, including dimension mismatch scenarios.
…bleTab and math_VectorBase to improve resource management. - Added buffer handling for small arrays to optimize performance. - Ensured proper assignment behavior in the copy assignment operator to prevent self-assignment issues.
- Removed tests for assignment dimension mismatch scenarios in move semantics for both math_Matrix and math_Vector. - Streamlined test cases to focus on valid move operations, enhancing clarity and maintainability.
There was a problem hiding this comment.
Pull Request Overview
This PR implements move semantics for math_Matrix and math_Vector classes to optimize resource management and improve performance when transferring ownership of large matrix/vector objects.
Key Changes:
- Added move constructors and move assignment operators to
math_VectorBase,math_Matrix, andmath_DoubleTab - Optimized move operations to avoid unnecessary copying when dimensions match and both objects use heap allocation
- Added comprehensive test coverage for move semantics with both heap-allocated (large) and buffer-allocated (small) objects
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
math_VectorBase.hxx |
Added move constructor and move assignment operator declarations |
math_VectorBase.lxx |
Implemented move constructor with conditional buffer/heap logic and move assignment operator |
math_Matrix.hxx |
Updated move assignment operator signature (removed noexcept) |
math_Matrix.lxx |
Enhanced move assignment operator with dimension matching logic and fallback to copy |
math_DoubleTab.hxx |
Added move constructor, copy/move assignment operators, and IsDeletable() helper method |
math_Vector_Test.cxx |
Added comprehensive tests for move constructor and move assignment with large and small vectors |
math_Matrix_Test.cxx |
Added comprehensive tests for move constructor and move assignment with large and small matrices |
| //================================================================================================== | ||
|
|
||
| inline math_Matrix& math_Matrix::operator=(math_Matrix&& Other) noexcept | ||
| inline math_Matrix& math_Matrix::operator=(math_Matrix&& Other) |
There was a problem hiding this comment.
Parameter name 'Other' does not follow the OCCT naming convention. It should be 'theOther' to match the project's parameter naming pattern (theParameterName).
AtheneNoctuaPt
approved these changes
Nov 24, 2025
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.