> Now, at anyone time, from 2 to 5 of the items will be populated
> (starting index 0). And I need to shuffle just those entries up like
> this:
>
> Imagine that indexes 0, 1 and 2 are used. Then 1 moves to 0,
> 2 to 1, and 0 to 2.
Aha, now I see. So you don't want to "shuffle" them, you want to rotate
them, right? This is what I would do:
#include <algorithm>
void f()
{
int array[ 5 ];
// populate it
// rotate the first three items
std::rotate( array, array + 1, array + 3 ); }
Pretty straightforward.
-------------
Ehsan Akhgari
Farda Technology (http://www.farda-tech.com/)
List Owner: [EMAIL PROTECTED]
[ Email: [EMAIL PROTECTED] ]
[ WWW: http://www.beginthread.com/Ehsan ]
But the thought is one thing, the deed another, and the idea of the deed
still another. The wheel of causality does not roll between them.
-Thus Spoke Zarathustra, F. W. Nietzsche
_______________________________________________
msvc mailing list
[EMAIL PROTECTED]
See http://beginthread.com/mailman/listinfo/msvc_beginthread.com for subscription
changes, and list archive.