Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2000-11-13 08:36:06


----- Original Message -----
From: "Kevlin Henney" <kevlin_at_[hidden]>

> >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?

> 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?

-Dave


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