Include everything, Separate with "using"
Posted
by
Dave
on Stack Overflow
See other posts from Stack Overflow
or by Dave
Published on 2011-03-01T05:06:08Z
Indexed on
2011/03/01
15:25 UTC
Read the original article
Hit count: 313
I'm developing a C++ library. It got me thinking of the ways Java and C# handle including different components of the libraries. For example, Java uses "import" to allow use of classes from other packages, while C# simply uses "using" to import entire modules.
My questions is, would it be a good idea to #include everything in the library in one massive include and then just use the using directive to import specific classes and modules? Or would this just be down right crazy?
EDIT: Good responses so far, here are a few mitigating factors which I feel add to this idea:
1) Internal #includes are kept as normal (short and to the point)
2) The file which includes everything is optionally supplied with the library to those who wish to use it
3) You could optionally make the big include file part of the pre-compiled header
© Stack Overflow or respective owner