> OK, 'first' is an iterator to the first item of the collection (in your
> case, an array.)  'last' is an iterator to one past the last
> element in the
> collection.  Now, let me describe 'middle'.
>
> std::rotate divides a range into two segments, and switches them in the
> collection.  For example, if you want to shift {1,2,3,4,5} two
> items to the
> top, you would get {3,4,5,1,2}.  Now, 'middle' is an iterator to
> the item at
> the first place on the second part (in our example, 3.)  The
> following code
> implements the idea:
>
>  int array[] = {1,2,3,4,5};
>  std::rotate( array, // pointer to the first element
>               array + 2, // pointer to the first element in the
> second part
>               array + 5 // pointer to the last element  );

Thanks Ehsan, even I found that explanation in MSDN to be horrible, but I
now understand it. Nobody panic, but I might just start looking at using
some STL in future projects out of interest...

--
Jason Teagle
[EMAIL PROTECTED]



_______________________________________________
msvc mailing list
[EMAIL PROTECTED]
See http://beginthread.com/mailman/listinfo/msvc_beginthread.com for subscription 
changes, and list archive.

Reply via email to