Re: class templates with pointers to each other in seperate header
* Luke Meyers:
Alf P. Steinbach wrote:
* Luke Meyers:
It's unfortunate that so many people are taught to add #includes into
headers for everything their class uses. You should only #include what
you absolutely *have to* in a header (most commonly base classes,
by-value members (when not using pimpl), and typedefs), and leave the
rest for the implementation file. This really helps to cut down on
build times and recompilation.
On the contrary.
The Microsoft style
Beg pardon? I don't know what "the Microsoft style" is, and I'm
curious why you assume I would. I'll proceed assuming you meant the
practice of minimizing header includes, preferring to place those
includes as locally as possible -- that is, in the implementation
It may be that we're not really disagreeing.
However, what you wrote has as its limit to not include other headers in
a header, and leave that to the implementation files, since what you
"absolutely /have to/" include is zero, nix, nada; a common practice
with Microsoft (e.g. Visual Studio generated headers are that way).
Since I only criticized that abhorrent practice, not stating anything
about my own preferences, perhaps that would be in order; see ch 1.6 of
where the most important quote is (quoting myself :-) ) "A header file
should always be self-contained: it should be possible to just #include
it without having to #include any other headers first"; subject to that
requirement it's fine to minimize the dependencies, otherwise IMO not.
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
Q: What is the most annoying thing on usenet and in e-mail?