#include <iostream>
#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(std::forward<SS>(s) << std::forward<TT>(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 {};
int main() {
std::cout <<is_streamable<std::stringstream, C>::value << std::endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3N0cmVhbT4KI2luY2x1ZGUgPHR5cGVfdHJhaXRzPgoKdGVtcGxhdGU8dHlwZW5hbWUgUywgdHlwZW5hbWUgVD4KY2xhc3MgaXNfc3RyZWFtYWJsZQp7CiAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBTUywgdHlwZW5hbWUgVFQ+CiAgICBzdGF0aWMgYXV0byB0ZXN0KFNTJiYgcywgVFQmJiB0KQogICAgLT4gZGVjbHR5cGUoc3RkOjpmb3J3YXJkPFNTPihzKSA8PCBzdGQ6OmZvcndhcmQ8VFQ+KHQpKTsKICAgIAogICAgc3RydWN0IGR1bW15X3Qge307CiAgICBzdGF0aWMgZHVtbXlfdCB0ZXN0KC4uLik7CiAgICAKICAgIHVzaW5nIHJldHVybl90eXBlID0gZGVjbHR5cGUodGVzdChzdGQ6OmRlY2x2YWw8Uz4oKSwgc3RkOjpkZWNsdmFsPFQ+KCkpKTsKICAgIApwdWJsaWM6CiAgICBzdGF0aWMgY29uc3QgYm9vbCB2YWx1ZSA9ICFzdGQ6OmlzX3NhbWU8cmV0dXJuX3R5cGUsIGR1bW15X3Q+Ojp2YWx1ZTsKfTsKCmNsYXNzIEMge307CgppbnQgbWFpbigpIHsKCXN0ZDo6Y291dCA8PGlzX3N0cmVhbWFibGU8c3RkOjpzdHJpbmdzdHJlYW0sIEM+Ojp2YWx1ZSA8PCBzdGQ6OmVuZGw7CglyZXR1cm4gMDsKfQ==