Library: need to exclude C++ stream sources from string conversion

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«....
This commit is contained in:
Fischlurch 2024-03-15 00:41:34 +01:00
parent 599407deea
commit 95198c5f2a

View file

@ -73,6 +73,8 @@ namespace std {
template<class X> class reference_wrapper;
template<class X> class shared_ptr;
template<class X, class D> class unique_ptr;
template<class C, class T> class basic_filebuf;
template<class C> class char_traits;
}
namespace lib{
template<class X, class B> class P;
@ -368,17 +370,23 @@ namespace meta {
>
{ };
// need to exclude files and input streams from automatic string conversion
template<typename X>
struct is_StreamSource
: is_same<X, std::basic_filebuf<char, std::char_traits<char> > >
{ };
/** when to use custom string conversions for output streams */
template<typename X>
struct use_StringConversion4Stream
: __and_<is_class<typename Strip<X>::TypePlain>
,__not_<is_pointer<X>>
,__not_<can_lexical2string<X>>
,__not_<is_StreamSource<X>>
>
{ };
/** detect smart pointers */
template<typename X>
struct is_smart_ptr