|
565 | 565 | RandomAccessIterator last,
|
566 | 566 | UniformRandomBitGenerator&& g);
|
567 | 567 |
|
| 568 | + // \ref{alg.shift}, shift |
| 569 | + template<class ForwardIterator> |
| 570 | + constexpr ForwardIterator |
| 571 | + shift_left(ForwardIterator first, ForwardIterator last, |
| 572 | + typename iterator_traits<ForwardIterator>::difference_type n); |
| 573 | + template<class ExecutionPolicy, class ForwardIterator> |
| 574 | + ForwardIterator |
| 575 | + shift_left(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} |
| 576 | + ForwardIterator first, ForwardIterator last, |
| 577 | + typename iterator_traits<ForwardIterator>::difference_type n); |
| 578 | + template<class ForwardIterator> |
| 579 | + ForwardIterator |
| 580 | + shift_right(ForwardIterator first, ForwardIterator last, |
| 581 | + typename iterator_traits<ForwardIterator>::difference_type n); |
| 582 | + template<class ExecutionPolicy, class ForwardIterator> |
| 583 | + ForwardIterator |
| 584 | + shift_right(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} |
| 585 | + ForwardIterator first, ForwardIterator last, |
| 586 | + typename iterator_traits<ForwardIterator>::difference_type n); |
| 587 | + |
568 | 588 | // \ref{alg.partitions}, partitions
|
569 | 589 | template<class InputIterator, class Predicate>
|
570 | 590 | constexpr bool is_partitioned(InputIterator first, InputIterator last, Predicate pred);
|
|
3526 | 3546 |
|
3527 | 3547 | \end{itemdescr}
|
3528 | 3548 |
|
| 3549 | +\rSec2[alg.shift]{Shift} |
| 3550 | + |
| 3551 | +\indexlibrary{\idxcode{shift_left}}% |
| 3552 | +\begin{itemdecl} |
| 3553 | +template<class ForwardIterator> |
| 3554 | + constexpr ForwardIterator |
| 3555 | + shift_left(ForwardIterator first, ForwardIterator last, |
| 3556 | + typename iterator_traits<ForwardIterator>::difference_type n); |
| 3557 | +template<class ExecutionPolicy, class ForwardIterator> |
| 3558 | + ForwardIterator |
| 3559 | + shift_left(ExecutionPolicy&& exec, ForwardIterator first, ForwardIterator last, |
| 3560 | + typename iterator_traits<ForwardIterator>::difference_type n); |
| 3561 | +\end{itemdecl} |
| 3562 | + |
| 3563 | +\begin{itemdescr} |
| 3564 | +\pnum |
| 3565 | +\requires |
| 3566 | +The type of \tcode{*first} shall satisfy |
| 3567 | +the \tcode{MoveAssignable} requirements. |
| 3568 | + |
| 3569 | +\pnum |
| 3570 | +\effects |
| 3571 | +If \tcode{n <= 0} or \tcode{n >= last - first}, does nothing. |
| 3572 | +Otherwise, moves the element |
| 3573 | +from position \tcode{first + n + i} |
| 3574 | +into position \tcode{first + i} |
| 3575 | +for each non-negative integer \tcode{i < (last - first) - n}. |
| 3576 | +In the first overload case, does so in order starting |
| 3577 | +from \tcode{i = 0} and proceeding to \tcode{i = (last - first) - n - 1}. |
| 3578 | + |
| 3579 | +\pnum |
| 3580 | +\returns |
| 3581 | +\tcode{first + (last - first - n)} |
| 3582 | +if \tcode{n} is positive and \tcode{n < last - first}, |
| 3583 | +otherwise \tcode{first} if \tcode{n} is positive, otherwise \tcode{last}. |
| 3584 | + |
| 3585 | +\pnum |
| 3586 | +\complexity |
| 3587 | +At most \tcode{(last - first) - n} assignments. |
| 3588 | +\end{itemdescr} |
| 3589 | + |
| 3590 | +\indexlibrary{\idxcode{shift_right}}% |
| 3591 | +\begin{itemdecl} |
| 3592 | +template<class ForwardIterator> |
| 3593 | + ForwardIterator |
| 3594 | + shift_right(ForwardIterator first, ForwardIterator last, |
| 3595 | + typename iterator_traits<ForwardIterator>::difference_type n); |
| 3596 | +template<class ExecutionPolicy, class ForwardIterator> |
| 3597 | + ForwardIterator |
| 3598 | + shift_right(ExecutionPolicy&& exec, ForwardIterator first, ForwardIterator last, |
| 3599 | + typename iterator_traits<ForwardIterator>::difference_type n); |
| 3600 | +\end{itemdecl} |
| 3601 | + |
| 3602 | +\begin{itemdescr} |
| 3603 | +\pnum |
| 3604 | +\requires |
| 3605 | +The type of \tcode{*first} shall satisfy |
| 3606 | +the \tcode{MoveAssignable} requirements. |
| 3607 | +\tcode{ForwardIterator} shall meet |
| 3608 | +the requirements of a bidirectional iterator\iref{bidirectional.iterators} or |
| 3609 | +the \tcode{ValueSwappable} requirements. |
| 3610 | + |
| 3611 | +\pnum |
| 3612 | +\effects |
| 3613 | +If \tcode{n <= 0} or \tcode{n >= last - first}, does nothing. |
| 3614 | +Otherwise, moves the element |
| 3615 | +from position \tcode{first + i} into \tcode{position first + n + i} |
| 3616 | +for each non-negative integer \tcode{i < (last - first) - n}. |
| 3617 | +In the first overload case, if \tcode{ForwardIterator} satisfies |
| 3618 | +the requirements of a bidirectional iterator, |
| 3619 | +does so in order starting |
| 3620 | +from \tcode{i = (last - first) - n - 1} and proceeding to \tcode{i = 0}. |
| 3621 | + |
| 3622 | +\pnum |
| 3623 | +\returns |
| 3624 | +\tcode{first + n} |
| 3625 | +if \tcode{n} is positive and \tcode{n < last - first}, |
| 3626 | +otherwise \tcode{last} if \tcode{n} is positive, otherwise \tcode{first}. |
| 3627 | + |
| 3628 | +\pnum |
| 3629 | +\complexity |
| 3630 | +At most \tcode{(last - first) - n} assignments or swaps. |
| 3631 | +\end{itemdescr} |
| 3632 | + |
3529 | 3633 | \rSec1[alg.sorting]{Sorting and related operations}
|
3530 | 3634 |
|
3531 | 3635 | \pnum
|
|
0 commit comments