Andre Poenitz <[EMAIL PROTECTED]> writes: | Every now and then somebody adds a member to the class but not to swap. | No compiler warning possible. Been there, done that. Removed swap again | in most cases. Called it a 'obscure theory'.
If you keep your class variables in a Pimpl, then it gets very easy... Class Foo { private: struct Pimpl; Pimpl * pimpl; }; Foo & operator=(Foo const & f) { Foo tmp(f); f.swap(this); } void Foo::swap(Foo * f) { std::swap(pimpl, f->pimpl); } -- Lgb