> Well... You could say the same about STL. In the case of STL, if a > maintenance programmer doesn't understand it, the solution is to make > him learn it, because it is standard and useful. I think that the > pimpl idiom, since it is written about extensively, is the same.
Please note that STL is a *library* which is part of *Standard C++* (that's where it gets its S from!), whereas pimpl is just an idiom. This is not to underestimate it, of course, but I think it's not quite proper to compare it to such a library. Indeed I agree that all C++ developers should learn and use the STL, but I wouldn't recommend it about pimpl, although like I said before it's useful in several cases. > That's true. I use it for interface classes and any class that defines > and uses a bunch of private classes. I use it when: > > 1) It is an interface to other programmer's code, or at least other > modules, or That's a good idea, because that other programmer might decide to change his .h files and/or interfaces declared in them (although they probably shouldn't, but this happens all the time in our imperfect world.) > 2) I would have to put an #include to one of my .h files in another .h > file, and the (slight) performance hit is not important. > > IOW, in .h files, I only #include system files (for instance "#include > <algorithm>") or definitions for base classes (because there is no way > around that), unless there are extenuating circumstances. I generally don't subscribe to the "don't #include any headers in your header files" school of thought, because I don't think it's that bad to justify using something as the pimpl, but I guess this has a lot to do with personal preferences, so I'll not debate it. :-) ------------- Ehsan Akhgari Farda Technology (http://www.farda-tech.com/) List Owner: [email protected] [ Email: [EMAIL PROTECTED] ] [ WWW: http://www.beginthread.com/Ehsan ] Under conditions of peace the warlike man attacks himself. -Beyond Good And Evil, F. W. Nietzsche _______________________________________________ msvc mailing list [email protected] See http://beginthread.com/mailman/listinfo/msvc_beginthread.com for subscription changes, and list archive.
