copying the targets of pointers

2012-07-27 Thread monarch_dodra
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 Here is the context of what I'm trying to do: struct S { struct Payload {} Payload payload;

Re: copying the targets of pointers

2012-07-27 Thread Artur Skawina
On 07/27/12 18:11, 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 Exactly the same, there's no difference between C and D pointers,

Re: copying the targets of pointers

2012-07-27 Thread monarch_dodra
On Friday, 27 July 2012 at 16:47:47 UTC, Artur Skawina wrote: On 07/27/12 18:11, 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

Re: copying the targets of pointers

2012-07-27 Thread Ali Çehreli
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.

Re: copying the targets of pointers

2012-07-27 Thread Simen Kjaeraas
On Fri, 27 Jul 2012 19:28:06 +0200, monarch_dodra monarchdo...@gmail.com wrote: I'm kind of confused, because every time I see pointer usage, the deference operator is omitted? For example: struct S { void foo(){}; } S* p = new S(); p.foo(); When and where

Re: copying the targets of pointers

2012-07-27 Thread Jonathan M Davis
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

Re: copying the targets of pointers

2012-07-27 Thread Artur Skawina
On 07/27/12 19:28, monarch_dodra wrote: On Friday, 27 July 2012 at 16:47:47 UTC, Artur Skawina wrote: On 07/27/12 18:11, 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