M
Marc Schellens
I want to get the sort indices of an valarray<type>
ie.
for type int and array
valarray<int> a( 0, 4);
a[0] = 7,
a[1] = 2,
a[2] = 9,
a[3] = 4,
I want to get as output a valarray<long> res
with:
res[0] == 1 // index of '2' first el
res[1] == 3 // 4 2nd el
res[2] == 0 // 7 3rd el
res[3] == 2 // 9 last el
All the sort* algorithms sort the array itsef, how
to get those indices most easily?
Speed is an issue.
Thanks,
Marc
ie.
for type int and array
valarray<int> a( 0, 4);
a[0] = 7,
a[1] = 2,
a[2] = 9,
a[3] = 4,
I want to get as output a valarray<long> res
with:
res[0] == 1 // index of '2' first el
res[1] == 3 // 4 2nd el
res[2] == 0 // 7 3rd el
res[3] == 2 // 9 last el
All the sort* algorithms sort the array itsef, how
to get those indices most easily?
Speed is an issue.
Thanks,
Marc