mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
add CCDeque.print
This commit is contained in:
parent
819c1f3249
commit
b3a527055f
2 changed files with 18 additions and 0 deletions
|
|
@ -134,3 +134,16 @@ let copy d =
|
|||
let d' = create () in
|
||||
iter (fun x -> push_back d' x) d;
|
||||
d'
|
||||
|
||||
type 'a printer = Format.formatter -> 'a -> unit
|
||||
|
||||
let print pp_x out d =
|
||||
let first = ref true in
|
||||
Format.fprintf out "@[<hov2>deque {";
|
||||
iter
|
||||
(fun x ->
|
||||
if !first then first:= false else Format.fprintf out ";@ ";
|
||||
pp_x out x
|
||||
) d;
|
||||
Format.fprintf out "}@]"
|
||||
|
||||
|
|
|
|||
|
|
@ -66,3 +66,8 @@ val to_seq : 'a t -> 'a sequence
|
|||
|
||||
val copy : 'a t -> 'a t
|
||||
(** Fresh copy *)
|
||||
|
||||
type 'a printer = Format.formatter -> 'a -> unit
|
||||
|
||||
val print : 'a printer -> 'a t printer
|
||||
(** @since NEXT_RELEASE *)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue