Boost logo

Boost :

From: Daniel Frey (daniel.frey_at_[hidden])
Date: 2003-10-01 05:45:31


David Abrahams wrote:
> All types have a copy_ctor.

I heard that several times, but I am still not sure if it's true. I
think you are refering to the fact that the compiler generates a
copy-ctor if the class doesn't provide one explicitly, right? But what
happens if the compiler cannot create a copy-ctor? Consider:

class A
{
   A();
   A(A&);
public:
   A(int) {}
};

class B
{
   A a;
public:
   B(int i) : a(i) {}
};

int main()
{
   B b( 42 );
}

A perfectly legal example and AFAICS, B is a class without a copy-ctor.
Or is a copy-ctor declared but never defined for these cases? Any
enlightment appreciated... :)

Regards, Daniel

-- 
Daniel Frey
aixigo AG - financial training, research and technology
Schloß-Rahe-Straße 15, 52072 Aachen, Germany
fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99
eMail: daniel.frey_at_[hidden], web: http://www.aixigo.de

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