F32vec4 assignment, and operators

F32vec4 assignment, and operators

2 questions

1) The only way to access individual elements of the F32vec4 class is by using the [] operator, e.g.

F32vec4 test;
test[0] = 1.0; test[1] = 2.0; test[2] = 3.0;

std::cout << test[1];


This is *not* recommended - in "fvec.h" and in the manual it says that this is only for debugging purposes. If this is the case, then how does one get different values into the elements of the vector, outside of at creation using the constructor e.g.

F32vec4 test(1.0, 2.0, 3.0, 4.0);

2) In "fvec.h" there doesn't appear to be an operator "=" which copies one F32vec4 into another, e.g.

F32vec4 testA(1.0, 2.0, 3.0, 4.0)
F32vec4 testB = testA;

Although the above works, sometimes more complicated operations such as

F32vec4 * testA = new F32vec4[3];
F32vec4 * testB = new F32vec4[10];

testA[0] = testB[5];

do not always work. Do I need to define my own version of this copy operator? How can I do that without using the above mentioned [] operators (which are for debugging only)? Thanks in advance for advice/help!

1 post / 0 new
For more complete information about compiler optimizations, see our Optimization Notice.