[#BloombergLP-bslalg-ArrayPrimitives-rotate]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslalg.adoc[bslalg]::xref:BloombergLP/bslalg/ArrayPrimitives.adoc[ArrayPrimitives]::rotate
:relfileprefix: ../../../
:mrdocs:

Rotate elements so the middle becomes the new first element&period;

== Synopsis

Declared in `&lt;bslalg&lowbar;arrayprimitives&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class TARGET&lowbar;TYPE&gt;
static
void
rotate(
    TARGET&lowbar;TYPE* first,
    TARGET&lowbar;TYPE* middle,
    TARGET&lowbar;TYPE* last);
----

== Description

Move the elements of the parameterized `TARGET&lowbar;TYPE` in the array starting at the specified `first` address and ending immediately before the specified `middle` address to the array of the same length ending at the specified `last` address (and thus starting at the `last &hyphen; (middle &hyphen; first)` address), and move the elements previously in the array starting at `middle` and ending at `last` down to the `first` address&period; If the assignment operator throws an exception during this process, all of the elements in `&lsqb; first, last )&rsqb;` will have unspecified, but valid, values&period; The behavior is undefined unless `first &lt;&equals; middle &lt;&equals; last`&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *first*
| beginning of the array range to rotate
| *middle*
| element that becomes the new first after rotation
| *last*
| end of the array range to rotate (one past the last)
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
