On Friday, July 27, 2012 10:32:07 Ali Çehreli wrote: > On 07/27/2012 09:11 AM, monarch_dodra wrote: > > This is going to sound stupid, but how do you have two pointers' targets > > copy each other? since pointers are used like reference types, how do > > you write the C++ equivalent of "*p1 == *p2" > > The type must provide a function to make a copy of itself. Since arrays > have .dup, that may be a suitable name: > > auto newObject = object.dup;
That's only if you're dealing with references or if the pointers point to structs which are reference types (or if they're pointers to arrays, which would be a bit weird). If you're dealing with a built-in type or value type structs, then no dup is necessary. - Jonathan M Davis