Boost logo

Boost :

Subject: Re: [boost] [pimpl] Some comments
From: Sohail Somani (sohail_at_[hidden])
Date: 2014-06-06 08:57:57


On 06/06/2014 8:41 AM, Mostafa wrote:
> On Fri, 06 Jun 2014 05:03:21 -0700, Sohail Somani
> <sohail_at_[hidden]> 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


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