R
Rares Vernica
Hello,
I need help to replace the following code:
int *idx; //...
for (int i = 0; i < n; i++, ++out)
out = in[idx];
with something like:
int *idx; //...
std::transform(idx, idx + n, out, ...);
I think the operator for transform should look something like:
__gnu_cxx::compose1(in[], *idx)
So, I think, I need a function object to apply the [] operator to "in",
given an int and another one to apply the * operator to each element in
"idx".
Thanks in advance,
Rares Vernica
I need help to replace the following code:
int *idx; //...
for (int i = 0; i < n; i++, ++out)
out = in[idx];
with something like:
int *idx; //...
std::transform(idx, idx + n, out, ...);
I think the operator for transform should look something like:
__gnu_cxx::compose1(in[], *idx)
So, I think, I need a function object to apply the [] operator to "in",
given an int and another one to apply the * operator to each element in
"idx".
Thanks in advance,
Rares Vernica