package res

  1. Overview
  2. Docs

Interface to strategies

type t

The abstract type of strategies.

val default : t

Default strategy of this strategy implementation.

val grow : t -> int -> int

grow strat new_len

  • returns

    the new real length of some contiguous datastructure using strategy strat given new virtual length new_len. The user should then use this new real length to resize the datastructure.

    Be careful, the new (real) length must be larger than the new virtual length, otherwise your program will crash!

val shrink : t -> real_len:int -> new_len:int -> int

shrink strat ~real_len ~new_len

  • returns

    the new real length of a resizable datastructure given its current real length real_len and its required new virtual length new_len wrt. strategy strat. The user should then use this new real length to resize the datastructure. If -1 is returned, it is not necessary to resize.

    Be careful, the new (real) length must be larger than the new (virtual) length, otherwise your program may crash!

OCaml

Innovation. Community. Security.