Avoid including <iostream> 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., <istream> or <ostream>.
This commit is contained in:
Jeremy Nimmer
2024-12-30 07:23:23 -08:00
committed by Jesse Beder
parent 7470c2d871
commit 73ef0060aa
5 changed files with 4 additions and 5 deletions

View File

@@ -7,7 +7,6 @@
#pragma once
#endif
#include <iostream>
#include <cstddef>
#include "yaml-cpp/ostream_wrapper.h"

View File

@@ -2,7 +2,7 @@
#include <algorithm>
#include <cstring>
#include <iostream>
#include <ostream>
namespace YAML {
ostream_wrapper::ostream_wrapper()

View File

@@ -1,4 +1,4 @@
#include <iostream>
#include <istream>
#include "stream.h"

View File

@@ -11,7 +11,7 @@
#include <cstddef>
#include <deque>
#include <ios>
#include <iostream>
#include <istream>
#include <set>
#include <string>

View File

@@ -8,7 +8,7 @@
#endif
#include "yaml-cpp/mark.h"
#include <iostream>
#include <ostream>
#include <string>
#include <vector>