From 742271ad090b6eead2fd8c17fcc4c2a3dc58bf19 Mon Sep 17 00:00:00 2001 From: King_DuckZ Date: Tue, 24 May 2022 16:35:16 +0200 Subject: [PATCH] Get rid of the iostream include in bt::string --- examples/greet/main.cpp | 1 + include/wrenpp/detail/string_bt.hpp | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/examples/greet/main.cpp b/examples/greet/main.cpp index a9bb14e..7357397 100644 --- a/examples/greet/main.cpp +++ b/examples/greet/main.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #if defined(__GNU_LIBRARY__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 17) || __GLIBC__ > 2) # define HasSecureGetenv diff --git a/include/wrenpp/detail/string_bt.hpp b/include/wrenpp/detail/string_bt.hpp index 689a651..2ea006e 100644 --- a/include/wrenpp/detail/string_bt.hpp +++ b/include/wrenpp/detail/string_bt.hpp @@ -18,9 +18,13 @@ #ifndef id170B0E6C34D14EBA9B92A35977BDBFB3 #define id170B0E6C34D14EBA9B92A35977BDBFB3 +//#define PRINTABLE_STRING_BT + #include #include -#include +#if defined(PRINTABLE_STRING_BT) +# include +#endif #include namespace dhandy { @@ -28,8 +32,10 @@ namespace dhandy { template class string; +#if defined(PRINTABLE_STRING_BT) template std::basic_ostream& operator<< ( std::basic_ostream& parStream, const string& parString ); +#endif namespace implem { template constexpr bool eq (const string& l, const string& r); @@ -37,7 +43,9 @@ namespace dhandy { template class string { +#if defined(PRINTABLE_STRING_BT) friend std::ostream& operator<< <>( std::ostream& parStream, const string& parString ); +#endif friend constexpr bool implem::eq (const string&, const string&); public: using value_type = Ch; @@ -122,11 +130,13 @@ namespace dhandy { return implem::concat(std::make_index_sequence(), string(m_data), parOther); } +#if defined(PRINTABLE_STRING_BT) template inline std::ostream& operator<< (std::ostream& parStream, const string& parString) { parStream << parString.m_data; return parStream; } +#endif template constexpr bool string::operator== (const string& other) const {