Module Msat_backtrack__.Backtrackable_ref
Backtrackable ref
val create : ?copy:('a -> 'a) -> 'a -> 'a tCreate a backtrackable reference holding the given value initially.
- parameter copy
if provided, will be used to copy the value when
push_levelis called.
val set : 'a t -> 'a -> unitSet the reference's current content
val get : 'a t -> 'aGet the reference's current content
val update : 'a t -> ('a -> 'a) -> unitUpdate the reference's current content
val push_level : _ t -> unitPush a backtracking level, copying the current value on top of some stack. The
copyfunction will be used if it was provided increate.
val n_levels : _ t -> intNumber of saved values
val pop_levels : _ t -> int -> unitPop
nlevels, restoring to the value the reference was storingncalls topush_levelearlier.- raises Invalid_argument
if
nis bigger thann_levels.