Pimpl copying

Peter Kümmel syntheticpp at gmx.net
Fri Jul 14 18:35:56 BST 2006


Peter Kümmel wrote:
>> Many pimpls were just changed to (nested) Private.
>>
> 
> Have the guide lines changed again?
> 
> http://lists.kde.org/?l=kde-core-devel&m=114322798807520&w=2
> http://developer.kde.org/policies/librarypolicy.html
> 

Searching for "Private;" shows that the naming is totally inconsistent
in kdelibs. So the question is, must it be consistent? And if, which
name should be used?


>>> +#define KDE_PIMPL_ENABLE_COPY(X)  KDE_PIMPL_BASE_MACRO(public, X)
>>> +#define KDE_PIMPL_DISABLE_COPY(X) KDE_PIMPL_BASE_MACRO(private,X)
>> Does't KDE_PIMPL_DISABLE_COPY lead to unresolved smybols linking error 
>> with MSVC (see "unresolved symbols from value.cpp/.h" on k-c-d from 
>> 20.01.2006)?

Reading this thread I think the problem is more related to templates
(which does not mean we can use the pimpl macro).


If it is OK I will change the pimpl at least in kdecore to the
usage of the new pimpl macro.

As a next step I wanna change the macro to use a constness propagating
pointer wrapper, which eventuality is only used for debug builds.

As you know using the pimpl idiom breaks const correctness:

void Class::memberFunction() const {
    d->setPrivateData( 0 );
}





More information about the kde-core-devel mailing list