◐ Shell
clean mode source ↗

std::rotate_copy — cppreference.com

De cppreference.com

<metanoindex/>

<tbody> </tbody>

Déclaré dans l'en-tête

<algorithm>

template< class ForwardIt, class OutputIt > OutputIt rotate_copy( ForwardIt first, ForwardIt n_first, ForwardIt last, OutputIt d_first );

Copier les éléments de la gamme [first, last), à une autre gamme de début d_first de telle manière, que l'élément de n_first devient le premier élément de la nouvelle gamme n_first - 1 et devient le dernier élément .

Original:

Copies the elements from the range [first, last), to another range beginning at d_first in such a way, that the element n_first becomes the first element of the new range and n_first - 1 becomes the last element.

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Paramètres

first, last -

l'éventail des éléments à copier

Original:

the range of elements to copy

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

n_first -

l'élément à déplacer vers le début de la nouvelle plage

Original:

the element to move to the beginning of the new range

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

d_first -

au début de la plage de destination

Original:

beginning of the destination range

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Type requirements
-ForwardIt must meet the requirements of ForwardIterator.
-OutputIt must meet the requirements of OutputIterator.

Retourne la valeur

sortie itérateur à l'élément après le dernier élément copié .

Original:

Output iterator to the element past the last element copied.

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Mise en œuvre possible

template<class ForwardIt, class OutputIt>
OutputIt rotate_copy(ForwardIt first, ForwardIt n_first,
                           ForwardIt last, OutputIt d_first)
{
    d_first = std::copy(n_first, last, d_first);
    return std::copy(first, n_first, d_first);
}

Exemple

Complexité

linéaire de la distance entre first et last

Original:

linear in the distance between first and last

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Voir aussi

tourner l'ordre des éléments dans une gamme

Original:

rotates the order of elements in a range

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(fonction générique) [edit]