Skip to main content

swap

Implements the swap function.

from algorithm.swap import swap

swap

swap[T: Movable](inout lhs: T, inout rhs: T)

Swaps the two given arguments.

Parameters:

  • T (Movable): Constrained to Copyable types.

Args:

  • lhs (T): Argument value swapped with rhs.
  • rhs (T): Argument value swapped with lhs.