Boost logo

Boost :

From: Edward Diener (eddielee_at_[hidden])
Date: 2003-08-01 21:34:40

E. Gladyshev wrote:
>> Are you aware that the pImpl idiom is used for many
>> different things
> It defenitly has its place but not in modern C++.
>> or have
>> you just decided its not modern C++ at all because
>> you don't use it for the
>> things you want to do ?
> In my opinion modern C++ is more oriented toward
> program specifications and generic (compile-time)
> programming. In modern C++, the program functionality
> can be customized by specifying custom data types and
> using them in a generic way (library). It is more
> like a type oriented programming not implementation
> driven. pImpl doesn't fit there.

The pImpl technique is an idiom for hiding the private methods and data
members of a class from the view of the user of that class. It has aesthetic
appeal for me. It makes the user of the class see only what is relevant in
the class, while putting the implementation details of the class interface
somewhere else. That it also speeds up compilation by not having the class,
as the compiler sees it, change when the internal class as represented by
its private pImpl pointer changes, is a side benefit to it but not one I
consider overridingly important. I agree that it achieves little other than
an aesthetic view of class internals and a speed up in build times when a
class's implementation, as opposed to its end-user interface, changes. As
such there is no pragmatic design reason why it is necessary. These are the
major reasons, as I understand it, why the pImpl idiom is generally used and
why I have used it. But there may be other reasons.

I don't understand what this has to do with modern C++ as you see it. But I
think that your view of modern C++, a term perhaps taken from Mr.
Alexandrescu's fine book on template programming and metaprogramming
techniques, and nurtured by some of the equally fine work done by Boost
implementors, may be severely limited. I only hope that you don't get into
the habit of seeing all of modern C++ programming as template programming
only, and view all other programming and design idioms from that
perspective. To me this ioos what you are doing by syaing that the pImpl is
not part of modern C++.

Boost list run by bdawes at, gregod at, cpdaniel at, john at