From 73ef0060aaa1a9dc742c1d8a36fa336b35e94035 Mon Sep 17 00:00:00 2001 From: Jeremy Nimmer Date: Mon, 30 Dec 2024 07:23:23 -0800 Subject: [PATCH] Avoid including in library code Including iostream means introducing the static (global) constructors and destructors for std::cin, std::cerr, and std::cout. That extra init and fini code is undesirable when those streams are not actually used. Instead, we'll use the narrower includes for exactly what's needed, i.e., or . --- src/indentation.h | 1 - src/ostream_wrapper.cpp | 2 +- src/stream.cpp | 2 +- src/stream.h | 2 +- src/token.h | 2 +- 5 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/indentation.h b/src/indentation.h index 1a2ccae..2a0137e 100644 --- a/src/indentation.h +++ b/src/indentation.h @@ -7,7 +7,6 @@ #pragma once #endif -#include #include #include "yaml-cpp/ostream_wrapper.h" diff --git a/src/ostream_wrapper.cpp b/src/ostream_wrapper.cpp index 047a9f7..2936007 100644 --- a/src/ostream_wrapper.cpp +++ b/src/ostream_wrapper.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include namespace YAML { ostream_wrapper::ostream_wrapper() diff --git a/src/stream.cpp b/src/stream.cpp index 72f0ec0..794ae87 100644 --- a/src/stream.cpp +++ b/src/stream.cpp @@ -1,4 +1,4 @@ -#include +#include #include "stream.h" diff --git a/src/stream.h b/src/stream.h index 214104a..c5e3798 100644 --- a/src/stream.h +++ b/src/stream.h @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/token.h b/src/token.h index ebd8477..d93ad2b 100644 --- a/src/token.h +++ b/src/token.h @@ -8,7 +8,7 @@ #endif #include "yaml-cpp/mark.h" -#include +#include #include #include