Monday, October 21, 2013

Follow-up Pimpl question

Newsgroup: comp.lang.c++

Subject: Follow-up Pimpl question

From: Rupert Swarbrick <rswarbrick@...>

Date: Mon, 21 Oct 2013 23:39:27 +0100



I'm coming back to writing some C++ after a few years in Lisp-land, and

was wondering about the "pimpl idiom". I understand how to write and use

it, and have done in the past. However, I don't really understand what

it gains you over having an abstract base class in the header, along

with a factory function.



Presumably there's a significant difference, since people put up with

the reams of boilerplate required for passing functions through to the

implementation object. Can anyone explain to me what it is?





Rupert





PS: I'm not sure whether there are strong feelings about whether to use

this idiom or not. To be clear, I'm not trying to hear them! I can

see obvious downsides to keeping a pointer to an implementation

object (verbosity; have to be careful about destructor +

exceptions...) and I'm interested to know what the upsides are.







via Usenet Forums - Usenet Search,Free Usenet - comp.lang.c++ http://www.pocketbinaries.com/usenet-forums/showthread.php?112797-Follow-up-Pimpl-question&goto=newpost

View all the progranning help forums at:

http://www.pocketbinaries.com/usenet-forums/forumdisplay.php?128-Coding-forums

No comments:

Post a Comment