Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Deep copy
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-07-15 (15:08)
From: Eray Ozkural <erayo@c...>
Subject: Re: [Caml-list] Deep copy
On Monday 15 July 2002 13:06, zze-MARCHEGAY Michael stagiaire FTRD/DTL/LAN 
> Hi all,
> I'm writting a program that manipulates a graph structure and I need to
> make deep copies of some of the graph nodes. The function Oo.copy donesn't
> perform a deep copy and I haven't found any other that could make it.

You mean something like creating a new object on the heap and copying over the 
contents of an existing object.

If this were C++ all you had to do would be invoking the copy constructor
 Node* x = new Node(old_node);

>From the documentation OO.copy does look like a deep copy operation:

val copy : < .. > -> < .. >
Oo.copy o returns a copy of object o, that is a fresh object with the same 
methods and instance variables as o

Eray Ozkural <>
Comp. Sci. Dept., Bilkent University, Ankara
GPG public key fingerprint: 360C 852F 88B0 A745 F31B  EA0F 7C07 AE16 874D 539C

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: