@head @module std @title Class std::Pair<L, R> @index Pair

Instances of the Pair class represent immutable pairs of two arbitrary values. Pairs can only be constructed using the colon (:) operator. A typical use of pair objects is as arguments to the constructor of the @ref{std::Map} class, where pairs represent (key, value) pairs, and in range indexing. @class Pair @desc The Pair type. Pair objects can be constructed using the colon (:) operator. Within an index expression (inside square brackets [ ]), the left or right operand, or both, can be left out; in this case the values default to nil. @end

Member constants

@var left as L @desc The first (left) item in the pair. @end @var right as R @desc The second (right) item in the pair. @end

Operations

@op x : y @optype{L : R -> Pair} @desc Construct a pair with values x (left) and y (right). @end @op pair == x @optype{Pair == Object -> Boolean} @desc Pair objects can be compared for equality. Two pairs are equal if and only if both their left and right items are equal. @end @op Str(pair) @desc Convert a pair to a string. @end @op Hash(pair) @desc Return the hash value of a pair. @end