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).
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).
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.
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement