Skip to content

Testing mat operations with vec#114

Merged
sebsjames merged 12 commits intomainfrom
dev/mat_operators_and_vec
Feb 27, 2026
Merged

Testing mat operations with vec#114
sebsjames merged 12 commits intomainfrom
dev/mat_operators_and_vec

Conversation

@sebsjames
Copy link
Copy Markdown
Owner

@sebsjames sebsjames commented Feb 27, 2026

To make sure mat += vec does NOT work, and similar. See #113 for the query that motivated this.

Previously

mat += or -= vec worked (even with vec3/vec4 for mat<F, 4>)
mat + or - vec worked
mat == vec worked
mat != vec worked
mat = vec worked (assignment)
you could construct mat<F, 4> from a vec<F, 3> or vec<F, 4> (creating a translation matrix)

Now

mat = vec works if vec size is Nr * Nc (only)
mat == vec doesn't compile
mat != vec doesn't compile
mat +=/-=/+/- vec don't compile
you can't construct mat<F, 4> from a vec<F, 3> or vec<F, 4> (too confusing)
you can still construct mat from a vec of the right size, assumed to contain data in col major order

@sebsjames sebsjames merged commit ab7b159 into main Feb 27, 2026
9 checks passed
@sebsjames sebsjames deleted the dev/mat_operators_and_vec branch February 27, 2026 16:38
@sebsjames
Copy link
Copy Markdown
Owner Author

Oh, I should add: Big thanks to @iboB for the test-must-fail-to-compile code that I have used here!

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.

1 participant