
On 06/06/2014 8:41 AM, Mostafa wrote:
On Fri, 06 Jun 2014 05:03:21 -0700, Sohail Somani
wrote: On 06/06/2014 6:12 AM, Mostafa wrote:
When dealing with pimpl'd classes, the expected norm (in my experience) for making deep copies is to use the clone function.
Why?
Existing convention, Java (clone), C# (Clone), Objective-C (copy), and the RogueWave suite of C++ libraries (clone). Maybe this is just me, but I view pimpl'd classes much like C#/Java references.
C++ has value semantics as a core feature so if your project has a different convention, that will surprise a C++ programmer who started programming in the last 5-10 years. RogueWave and friends were initially written years ago when we didn't know what we know now about writing good C++ software. I used it and didn't enjoy it, but I'm sure it has improved since then. That being said, projects have conventions and if it is a convention for you, that's fine. I wouldn't make everyone use this convention through Boost.Pimpl though. Sohail