#include <iostream>
#include <iomanip>
#include <sstream>
#include <type_traits>
template<typename S, typename T>
class is_streamable
{
template<typename SS, typename TT>
static auto test(SS&& s, TT&& t) -> decltype(s << t);
struct dummy_t {};
static dummy_t test(...);
using return_type = decltype(test(std::declval<S>(), std::declval<T>()));
public:
static const bool value = !std::is_same<return_type, dummy_t>::value;
};
class C {};
class D {};
std::ostream& operator <<(std::ostream&, D const&);
int main() {
std::cout << std::boolalpha;
std::cout <<is_streamable<std::stringstream, C>::value << '\n';
std::cout <<is_streamable<std::stringstream, D>::value << '\n';
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8aW9tYW5pcD4KI2luY2x1ZGUgPHNzdHJlYW0+CiNpbmNsdWRlIDx0eXBlX3RyYWl0cz4KCnRlbXBsYXRlPHR5cGVuYW1lIFMsIHR5cGVuYW1lIFQ+CmNsYXNzIGlzX3N0cmVhbWFibGUKewogICAgdGVtcGxhdGU8dHlwZW5hbWUgU1MsIHR5cGVuYW1lIFRUPgogICAgc3RhdGljIGF1dG8gdGVzdChTUyYmIHMsIFRUJiYgdCkgLT4gZGVjbHR5cGUocyA8PCB0KTsKICAgIAogICAgc3RydWN0IGR1bW15X3Qge307CiAgICBzdGF0aWMgZHVtbXlfdCB0ZXN0KC4uLik7CiAgICAKICAgIHVzaW5nIHJldHVybl90eXBlID0gZGVjbHR5cGUodGVzdChzdGQ6OmRlY2x2YWw8Uz4oKSwgc3RkOjpkZWNsdmFsPFQ+KCkpKTsKICAgIApwdWJsaWM6CiAgICBzdGF0aWMgY29uc3QgYm9vbCB2YWx1ZSA9ICFzdGQ6OmlzX3NhbWU8cmV0dXJuX3R5cGUsIGR1bW15X3Q+Ojp2YWx1ZTsKfTsKCmNsYXNzIEMge307CgpjbGFzcyBEIHt9OwoKc3RkOjpvc3RyZWFtJiBvcGVyYXRvciA8PChzdGQ6Om9zdHJlYW0mLCBEIGNvbnN0Jik7CgppbnQgbWFpbigpIHsKCXN0ZDo6Y291dCA8PCBzdGQ6OmJvb2xhbHBoYTsKCXN0ZDo6Y291dCA8PGlzX3N0cmVhbWFibGU8c3RkOjpzdHJpbmdzdHJlYW0sIEM+Ojp2YWx1ZSA8PCAnXG4nOwoJc3RkOjpjb3V0IDw8aXNfc3RyZWFtYWJsZTxzdGQ6OnN0cmluZ3N0cmVhbSwgRD46OnZhbHVlIDw8ICdcbic7CglyZXR1cm4gMDsKfQ==