HH\ImmVector

The HH\ImmVector<Tv> class

This page is a quick reference for people already familiar with the class. If this is new to you, we strongly recommend reading the introductory guides first:


ImmVector is an immutable Vector. HHVM provides a native implementation for this class. The PHP class definition below is not actually used at run time; it is simply provided for the typechecker and for developer reference.

An ImmVector cannot be mutated. No elements can be added to it or removed from it, nor can elements be overwritten using assignment (i.e. $c[$k] = $v is not allowed).

$v = Vector {1, 2, 3};
$fv = $v->toImmVector();

construct it with a Traversable:

$a = array(1, 2, 3);
$fv = new ImmVector($a);

or use the literal syntax:

$fv = ImmVector {1, 2, 3};

Interface synopsis

class ImmVector implements ConstVector {...}