I always use to include string when declaring strings, however i noticed (after forgetting to include string) that my compiler ran it just fine without including it. I have Arch Linux with the latest G++ all the time, currently 4.8.2 20131219
So my questions are:
At what point did the compiler no longer require to include the header string, and what other headers might no longer need to be included as well with the latest compilers?
Note that in some implementations of the std library, some headers happen to include others. This is something that cannot be relied on when switching compilers.
In your case <iostream> probably includes <string> or something.
OK so it must be included in iostream library then as if i omit it i finally get the error. Although my questions still stands as which compiler does not include with iostream, soley because i checked MinGW on Windows and it is also included with the iostream library?
GCC's implementation of <iostream> has included the <string> header for as long as I can remember, but this is no guarantee. It might change in future versions.
It's best that you try to include all the headers you use but it's no big deal if you forget. It just means you, or someone else compiling your code, might have to add a lot of includes in the future if they happen to get errors because of it.