I\'m trying to write a type trait to detect if a type has overloaded operator<<() suitable to use to an output stream.
I\'m missing something because I\'m alwa
EDIT : As found by @jrok, it exist a generic operator<< for rvalue streams that interact badly.
Something is really wrong here, if you look at the code below tested on coliru, the 2 last lines compile even if it they should not…
std::stringstream ss;
B b;
int v;
std::cout << typeid(decltype(ss>>v )).name() << "\n" ;
std::cout << typeid(decltype(ss<<1 )).name() << "\n" ;
std::cout << typeid(decltype(std::declval()>>v )).name() << "\n" ;
std::cout << typeid(decltype(std::declval()<<1 )).name() << "\n" ;
//std::cout << typeid(decltype(ss>>b )).name() << "\n" ; // do not compile
//std::cout << typeid(decltype(ss<()>>b )).name() << "\n" ; // should not compile but succeed
std::cout << typeid(decltype(std::declval()<