DirectXMath icon indicating copy to clipboard operation
DirectXMath copied to clipboard

Add index operators to XMFLOAT2/3/4

Open M2002RST opened this issue 8 months ago • 0 comments

Authors, I want to add some index operators to XMFLOAT2, XMFLOAT3, and XMFLOAT4.

The reason is that iterating over a float vector is common in image processing. It's more convenient to add those overrides when people write a loop body.

Below is the example submission:

Image

I hope you could adopt those changes.

PS: It's safer for runtime to apply std::clamp to the index value, but this introduces additional computation. I can't judge if it's necessary.

M2002RST avatar Jul 02 '25 14:07 M2002RST