I had only just noticed my programs using the string class were compiling without including the <string>
header. It turns out that <iostream>
includes <ios_base>
which in turn includes <string>
.
Is this bad practice and should I explicitly include <string>
? Even if it's just a case of clarity?
Is it safe to assume this applies to more than just the <string>
header? Perhaps this is implemenaton specific and or does the standard state thge <string>
header be included via <ios_base>
and <iostream>
? Ensuring that any respected and widley used implementation will always include <string>
providing the the call to <iostram>
exists.