template based d pointer class

Alexander Kellett lypanov at kde.org
Tue May 20 22:05:14 BST 2003


On Sat, May 17, 2003 at 10:25:22PM +0200, Luis Pedro Coelho wrote:
> >   A nitpick: instead of the #define, it would be better to add a private
> > const member function. 
> non-const flavour as well, probably. This should be binary compatible (adding 
> inline private functions is binary compatible, no?).

not entirely sure either therefore making me 
kind of uncomfortable with it in any case :)

> > See http://www.gotw.ca/gotw/012.htm for a similarly flavored example.
> I cannot see the connection, sorry.

nor me, but, interesting read anyways ;-)

> >   Anyway, are there any classes with publicly available API without
> > d-pointers?
> 
> I think this was about a concrete problem Alex is dealing with..

yup

> Overall, I think that the code that Alex posted is a clever solution to the 
> problem in a "this is an ugly hack but we cannot break binary compatibility" 
> sort of way. I agree with you on the private inline members, though.

yup, makes sense.

> Also, I would say one should do (marked changes with "*********") to get rid 
> of explicit references to the implementation:
> *snip*
> KBookmarkBarPrivate::neededType KBookmarkBarPrivate::base::d_ptr = 0;

seems like a bit too much for me. the "=0" is already explicit enough
for me, so i just left out all these nice additions. though thanks for
the suggestions, they'll probably prove useful for me to keep in mind,
maybe i should read some of the literator on c++/generic programming :)

Alex




More information about the kde-core-devel mailing list