John Levon <[EMAIL PROTECTED]> writes:

| On Sun, May 26, 2002 at 11:42:30PM +0200, Lars Gullik Bjønnes wrote:
>
>> Why cannot a WorkArea_pimpl be used for this? Or in this case a gui
>> impl. I am wary of using pointer when we do not  have to.
>
| On an odd day, pimpls are hated, on an even day not :(
>
| It's a scoped_ptr, I think that's a clear enough pointer management
| system.
>
| I would rather turn it round and say: what is the advantage of the pimpl
| idiom in this case:

Then don't think pimpl at all, think;

class XWorkArea {
      ...
};


class QWorkArea {
      ...
};

and depending on compile options:

typedef XWorkArea WorkArea;

or 

typedef QWorkArea WorkArea;


Concrete types, no virtual functions.

| a) You get to use WorkArea blah; instead of boost::scoped_ptr<WorkArea> 
|    (why is this better, other than reducing flexibility of WorkArea ctor ?)
| b) any others ?
>
| Disadvantages :
>
| a) larger code
| b) clumsier specification of abstract methods (= 0 vs. blah() {
| pimpl_->blah() })

What do you need abstract methods for anyway?

-- 
        Lgb


Reply via email to