Using indices operator [] for float2 or float4

Hi all,
I can’t seem to find this but is there a way to use operator with float2 and float4.

2 more questions are

  1. How do we assign a float pointer.
    float* triangles;
    float* a = &triangles[index] ==> Gives me errors
    float* a = triangles + index ==> Gives me errors too

  2. How can we return multiple values from a function. Sort of passing an argument by reference

No, you can’t access the elements like an array because float2 and float4 are structs.

Both look fine. Can you post the exact error message?

Are you talking about device or global functions? For device functions, you can do it the same way you normally would: pass several parameters by reference. For global functions, you can’t return anything (even single values) and you can’t pass arguments by reference (as far as I know), so usually what you do is: allocate some memory on the device, pass it as a pointer to the global function, it writes the output to the to the device memory via the provided pointer, and finally you memcpy the contents of of the memory back to the host.