.. index:: py::builtins::range::swap .. _doxycast_pypp_classpy_1_1builtins_1_1range_1aa78d1ee6b842a776c1baf906cbc1ae9a: .. _py-builtins-range-swap: *py::builtins::range::*\ swap ============================= .. code-block:: cpp constexpr void swap(range& other); Swaps the range with another range. Parameter --------- ``other``: Another range. Complexity ---------- Constant. Example ------- .. code-block:: cpp #include #include int main() { py::range nums1(1, 10); py::range nums2(5); nums1.swap(nums2); py::print(nums1.stop()); } **Output**: .. code-block:: text 5