py::builtins::range::swap

constexpr void swap(range& other);

Swaps the range with another range.

Parameter

other: Another range.

Complexity

Constant.

Example

#include <pypp/builtins/range.hpp>
#include <pypp/builtins/print.hpp>

int main()
{
    py::range<int> nums1(1, 10);
    py::range<int> nums2(5);
    nums1.swap(nums2);
    py::print(nums1.stop());
}

Output:

5