GUDHI / gudhi-devel

The GUDHI library is a generic open source C++ library, with a Python interface, for Topological Data Analysis (TDA) and Higher Dimensional Geometry Understanding.
https://gudhi.inria.fr/
MIT License
246 stars 65 forks source link

missing iostream import #969

Closed DavidLapous closed 9 months ago

DavidLapous commented 10 months ago

output_diagram method needs iostream.

DavidLapous commented 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) ?

mglisse commented 9 months ago

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.