What made you snip the sentence that I was explicitly referring to?
>
>Therefore, any class can provide an exception safe swap. What's your
>point?
Your claim, as I understood it, was that _any class_ can provide an
exception safe swap _because_ one can always use pimpl. I still don't see
That is not a class that you are writing. It was created by someone
else.*
So what? Are classes specified by others not included in "any class"?
I have been told that some programmers have to program according to specs
given to them. I just think, the hint "use pimpl" is not helpful in some of
those cases.
Again, if you are writing a class, and you want to provide an
exception safe swap, then you have no excuses.
I agree that if you _design_ a class (as opposed to provide an
implementation for an already specified class) you can make sure that a
swap member can be implemented in an exception safe way (provided you have
similar control over all member objects). That, however, is a somewhat
weaker statement than the claim that _any class_ can provide an exception
safe swap member function. It's more like: whenever you face a class for
which you cannot implement swap() in an exception safe way, the fault is
with the design and that class could be replaced (absent other
considerations) by a different class that does not suffer from the flaw.
You are right to make that point. It is an important point that puts the
problem into the context of class design, where it belongs. I just thought
that your pimpl remark might be an overgeneralization.
Best
Kai-Uwe Bux