Calling assignment operator in copy constructor

Posted by stas on Stack Overflow See other posts from Stack Overflow or by stas
Published on 2010-04-14T16:05:55Z Indexed on 2010/04/14 16:13 UTC
Read the original article Hit count: 281

Filed under:
|
|

Are there some drawbacks of such implementation of copy-constructor?

Foo::Foo(const Foo& i_foo)
{
   *this = i_foo;
}

As I remember, it was recommend in some book to call copy constructor from assignment operator and use well-known swap trick, but I don't remember, why...

© Stack Overflow or respective owner

Related posts about c++

Related posts about copy-constructor