Sign in to follow this  
alex_and_his_towel

.

Recommended Posts

These files are probably already included in iostream (or somehow the compiler already included these files in Options or something), it has nothing to do with namespaces.
Edit: These header files can also be included in a precompiled header file, if your project use it (a header file that is compiled first, correct me if im wrong).

Share this post


Link to post
Share on other sites
iostream makes use of quite a lot of other parts of the Standard C++ Library, so naturally they'll reuse the code and include the appropriate headers with iostream. However, I'd assume that how the internal dependencies between the standard headers is structured is implementation defined, and as such I'd recommend you still include the headers that the definations are supposed to be in. For all you know other compilers or even other versions of your compiler won't include the same headers internally, thus breaking your code if you really on it.

Share this post


Link to post
Share on other sites
The C++ standard does not allow you to assume that any headers include any others. If you use something from a certain header, you are required to include that header to be strictly valid C++.

That being said, it's fair to assume that <iostream> will bring in <istream> and <ostream>, for example. But on the other hand, if you use something from <algorithm> or <iterator>, don't count on a container or *stream pulling in those.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this