.. index:: std::swap [py:builtins:range] .. _doxycast_pypp_namespacestd_1a4806888d1b8bf8fc0e33147f5826bb1c: .. _std-swap-py-builtins-range: *std::*\ swap (:ref:`py::builtins::range `) (specialization) =============================================================================== .. code-block:: cpp template constexpr void swap( py::builtins::range& lhs, py::builtins::range& rhs ) noexcept(noexcept(lhs.swap(rhs))); Swaps a range with another range. .. tip:: Equivalent to:: lhs.swap(rhs); Parameter --------- ``lhs``: A range. ``rhs``: Another range. Complexity ---------- Constant. Example ------- .. code-block:: cpp #include #include int main() { py::range nums1(1, 10); py::range nums2(5); std::swap(nums1, nums2); py::print(nums1.stop()); } **Output**: .. code-block:: text 5