N
Noah Roberts
I know there must be a way to do this using stl functions and not
reinventing the sort loops and such but I need to sort several arrays
side by side using one as the "key". Interested in ideas here...
Two directions I can think of would be to create some sort of iterator
or to create an object to wrap the value and index of the key array and
then place these in a vector and sort it. Creating an iterator seems
like maybe too complex but would probably be the more efficient
way...maybe it could be generalized enough to use again sometime. It
would certainly teach me more about iterators as I have never built my
own; always use what is there already. The other would be easier,
maybe.
I'm very open to suggestion here.
reinventing the sort loops and such but I need to sort several arrays
side by side using one as the "key". Interested in ideas here...
Two directions I can think of would be to create some sort of iterator
or to create an object to wrap the value and index of the key array and
then place these in a vector and sort it. Creating an iterator seems
like maybe too complex but would probably be the more efficient
way...maybe it could be generalized enough to use again sometime. It
would certainly teach me more about iterators as I have never built my
own; always use what is there already. The other would be easier,
maybe.
I'm very open to suggestion here.