From 95198c5f2a2292b296f8abe78773f2bba3abd55f Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Fri, 15 Mar 2024 00:41:34 +0100 Subject: [PATCH] Library: need to exclude C++ stream sources from string conversion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the Lumiera code base, a convenient string conversion is used an many places, and is also ''magically'' integrated into the usual C++ style output with `<<` operators. However, there is a ''gotcha'' — in the ''rare cases'' when we actually want to use the C++ input/output framework to copy stream data from an input source into an output sink, obviously we do not want the input source to be »string converted«.... --- src/lib/meta/trait.hpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/lib/meta/trait.hpp b/src/lib/meta/trait.hpp index 0497d16ab..0b33c83cc 100644 --- a/src/lib/meta/trait.hpp +++ b/src/lib/meta/trait.hpp @@ -73,6 +73,8 @@ namespace std { template class reference_wrapper; template class shared_ptr; template class unique_ptr; + template class basic_filebuf; + template class char_traits; } namespace lib{ template class P; @@ -368,17 +370,23 @@ namespace meta { > { }; + // need to exclude files and input streams from automatic string conversion + template + struct is_StreamSource + : is_same > > + { }; + /** when to use custom string conversions for output streams */ template struct use_StringConversion4Stream : __and_::TypePlain> ,__not_> ,__not_> + ,__not_> > { }; - /** detect smart pointers */ template struct is_smart_ptr