From e65f977135d5d688a36591f29f18bda1e0294ed9 Mon Sep 17 00:00:00 2001 From: Joao Paulo Magalhaes Date: Tue, 24 Nov 2020 00:24:17 +0000 Subject: [PATCH 1/2] fix: never include iostream unless it's absolutely necessary --- include/fast_float/decimal_to_binary.h | 1 - include/fast_float/float_common.h | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/include/fast_float/decimal_to_binary.h b/include/fast_float/decimal_to_binary.h index e85f5506..0dd05a29 100644 --- a/include/fast_float/decimal_to_binary.h +++ b/include/fast_float/decimal_to_binary.h @@ -10,7 +10,6 @@ #include #include #include -#include namespace fast_float { diff --git a/include/fast_float/float_common.h b/include/fast_float/float_common.h index f6ffcb61..90a111a5 100644 --- a/include/fast_float/float_common.h +++ b/include/fast_float/float_common.h @@ -363,8 +363,8 @@ constexpr int binary_format::smallest_power_of_ten() { } // namespace fast_float // for convenience: -#include -inline std::ostream &operator<<(std::ostream &out, const fast_float::decimal &d) { +template +inline OStream& operator<<(OStream &out, const fast_float::decimal &d) { out << "0."; for (size_t i = 0; i < d.num_digits; i++) { out << int32_t(d.digits[i]); From 663fd91d8f853faa182c8a18e237412d933f03d7 Mon Sep 17 00:00:00 2001 From: Joao Paulo Magalhaes Date: Tue, 24 Nov 2020 00:40:28 +0000 Subject: [PATCH 2/2] fix: include of iostream is now required on client code --- tests/exhaustive32.cpp | 4 ++-- tests/exhaustive32_64.cpp | 4 ++-- tests/exhaustive32_midpoint.cpp | 4 ++-- tests/long_exhaustive32.cpp | 4 ++-- tests/long_exhaustive32_64.cpp | 4 ++-- tests/long_random64.cpp | 2 +- tests/random64.cpp | 2 +- tests/random_string.cpp | 4 +++- tests/short_random_string.cpp | 3 ++- tests/string_test.cpp | 2 +- 10 files changed, 18 insertions(+), 15 deletions(-) diff --git a/tests/exhaustive32.cpp b/tests/exhaustive32.cpp index dd354d99..bcbce791 100644 --- a/tests/exhaustive32.cpp +++ b/tests/exhaustive32.cpp @@ -1,7 +1,7 @@ #include "fast_float/fast_float.h" - +#include #include #include @@ -56,4 +56,4 @@ int main() { std::cout << std::endl; std::cout << "all ok" << std::endl; return EXIT_SUCCESS; -} \ No newline at end of file +} diff --git a/tests/exhaustive32_64.cpp b/tests/exhaustive32_64.cpp index c0d6184e..46a35b03 100644 --- a/tests/exhaustive32_64.cpp +++ b/tests/exhaustive32_64.cpp @@ -1,7 +1,7 @@ #include "fast_float/fast_float.h" - +#include #include #include @@ -70,4 +70,4 @@ int main() { std::cout << std::endl; std::cout << "all ok" << std::endl; return EXIT_SUCCESS; -} \ No newline at end of file +} diff --git a/tests/exhaustive32_midpoint.cpp b/tests/exhaustive32_midpoint.cpp index 72469cdc..828655f8 100644 --- a/tests/exhaustive32_midpoint.cpp +++ b/tests/exhaustive32_midpoint.cpp @@ -1,6 +1,6 @@ #include "fast_float/fast_float.h" - +#include #include #include @@ -119,4 +119,4 @@ int main() { std::cout << std::endl; std::cout << "all ok" << std::endl; return EXIT_SUCCESS; -} \ No newline at end of file +} diff --git a/tests/long_exhaustive32.cpp b/tests/long_exhaustive32.cpp index 916960c8..19ea3f37 100644 --- a/tests/long_exhaustive32.cpp +++ b/tests/long_exhaustive32.cpp @@ -1,7 +1,7 @@ #include "fast_float/fast_float.h" - +#include #include #include @@ -57,4 +57,4 @@ int main() { std::cout << std::endl; std::cout << "all ok" << std::endl; return EXIT_SUCCESS; -} \ No newline at end of file +} diff --git a/tests/long_exhaustive32_64.cpp b/tests/long_exhaustive32_64.cpp index 9185735b..5f7dafd8 100644 --- a/tests/long_exhaustive32_64.cpp +++ b/tests/long_exhaustive32_64.cpp @@ -1,6 +1,6 @@ #include "fast_float/fast_float.h" - +#include #include #include @@ -56,4 +56,4 @@ int main() { std::cout << std::endl; std::cout << "all ok" << std::endl; return EXIT_SUCCESS; -} \ No newline at end of file +} diff --git a/tests/long_random64.cpp b/tests/long_random64.cpp index 47c4d0ca..38dce21d 100644 --- a/tests/long_random64.cpp +++ b/tests/long_random64.cpp @@ -1,6 +1,6 @@ #include "fast_float/fast_float.h" - +#include #include #include diff --git a/tests/random64.cpp b/tests/random64.cpp index d169fbb2..8d5c59df 100644 --- a/tests/random64.cpp +++ b/tests/random64.cpp @@ -1,6 +1,6 @@ #include "fast_float/fast_float.h" - +#include #include #include diff --git a/tests/random_string.cpp b/tests/random_string.cpp index a58a092f..ed9fb6b3 100644 --- a/tests/random_string.cpp +++ b/tests/random_string.cpp @@ -1,4 +1,6 @@ #include "fast_float/fast_float.h" + +#include #include #include @@ -212,4 +214,4 @@ int main() { } std::cout << "Failure." << std::endl; return EXIT_FAILURE; -} \ No newline at end of file +} diff --git a/tests/short_random_string.cpp b/tests/short_random_string.cpp index 0d317b6a..9bec6593 100644 --- a/tests/short_random_string.cpp +++ b/tests/short_random_string.cpp @@ -1,4 +1,5 @@ #include "fast_float/fast_float.h" +#include #include #include @@ -208,4 +209,4 @@ int main() { } std::cout << "Failure." << std::endl; return EXIT_FAILURE; -} \ No newline at end of file +} diff --git a/tests/string_test.cpp b/tests/string_test.cpp index a6f47e00..ebc4b356 100644 --- a/tests/string_test.cpp +++ b/tests/string_test.cpp @@ -1,5 +1,5 @@ #include "fast_float/fast_float.h" - +#include #include #if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) || defined(sun) || defined(__sun)