Boost logo

Boost :

From: Kevlin Henney (kevlin_at_[hidden])
Date: 2000-11-13 09:13:49


In message <018801c04d76$ad0ffe00$0500a8c0_at_[hidden]>, David
Abrahams <abrahams_at_[hidden]> writes
>> >Are you saying that when I write this:
>> >
>> >struct Foo { ... };
>> >any x(Foo());
>> >any y(x);
>> >
>> >that Foo::Foo(const Foo&) is not called by the last line? If not, I have
>> >completely misunderstood your documentation and more clarification is
>> >probably warranted.
>>
>> Yes, this is correct.
>
>Really, Foo::Foo(const Foo&) is /not/ called by the last line? Or have I
>misunderstood you in a new way?

Oops! No, I have misunderstood you in a new way! Sorry, not enough
caffeine.

>> What I was clarifying above is that in the last
>> line it is y's copy constructor that is called, not x's (which is what
>> the phrase "copy constructor of the contents of x" means, ie x's
>> content's copy constructor).
>
>If I understand your class right, the reason for wording things as I have
>suggested is illustrated even better by:
>
>struct Foo { ... };
>any y(1);
>any x(Foo());
>y = x; // y has contents (1), x has contents (Foo()). I presume x's contents
>get copied?

Yes, which is what my wording says but not yours :->

Kevlin
____________________________________________________________

  Kevlin Henney phone: +44 117 942 2990
  Curbralan Limited mobile: +44 7801 073 508
  mailto:kevlin_at_[hidden] fax: +44 870 052 2289
  http://www.curbralan.com
____________________________________________________________


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk