Closed DavidLapous closed 9 months ago
It isn't good practice to have other headers depend on the full iostream
I didn't know that, what's the reason ? Isn't this include ignored by some kind of #pragma once
in general (so adding this line doesn't cost anything) ?
I didn't know that, what's the reason ? Isn't this include ignored by some kind of
#pragma once
in general (so adding this line doesn't cost anything) ?
If there is another #include <iostream>
, sure, the subsequent ones are free. The issue is that it prevents from writing a program that uses your header but does not include <iostream>
at all. And including <iostream>
doesn't just declare some stuff, it also causes at runtime the initialization of the standard I/O system. That's not a problem for the type of applications we write, but in other areas (say embedded systems) it is something people try to avoid.
output_diagram
method needsiostream
.