Standard library / std::algorithms

std::algorithms

std::algorithms provides common algorithms over collections. Today, a small Supported forms exists for scalar types.

Full reference: algorithms.

Importing#

import std::algorithms;

Example: clamp_int#

import std::algorithms;

fn main () -> int {
  if std::algorithms::clamp_int(10, 0, 5) != 5 { return 1; }
  if std::algorithms::clamp_int(-1, 0, 5) != 0 { return 2; }
  return 0;
}

See also#

Source repository · Edit this page · View Markdown