Module Res.DefStrat


module DefStrat: Strat.T  with type t = float * float * int
Default strategy for resizable datastructures

type t is a triple waste, shrink_trig, min_size, where waste (default: 1.5) indicates by how much the array should be grown in excess when reallocation is triggered, shrink_trig (default: 0.5) at which percentage of excess elements it should be shrinked and min_size (default: 16 elements) is the minimum size of the resizable array.


type t 
The abstract type of strategies.
val default : t
Default strategy of this strategy implementation.
val grow : t -> (int -> unit) -> int -> unit
grow strat resizer new_len grows some contiguous datastructure using strategy strat to a new (virtual) length new_len by calling its resizer function with its new (real) length. Be careful, the new (real) length must be larger than the new (virtual) length, otherwise your program will crash!
val shrink : t -> (int -> unit) -> int -> int -> unit
shrink strat resizer real_len new_len (possibly) shrinks some contiguous datastructure of length real_len depending on its demanded new (virtual) length new_len by calling its resizer function with its new (real) length. Be careful, the new (real) length must be larger than the new (virtual) length, otherwise your program will crash!