#include <iostream>
#include <type_traits>
using namespace std;
template<typename...Ts>
struct are_same;
template<typename T, typename U, typename...Ts>
struct are_same<T, U, Ts...>
{
static const int value = is_same<T, U>::value && are_same<U, Ts...>::value;
};
template<typename T>
struct are_same<T>
{
static const int value = 1;
};
int main()
{
cout << are_same<int, int, int, int>::value << endl;
cout << are_same<int, double, int, int>::value << endl;
conditional<are_same<int, int, double>::value, int, double>::type a;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dHlwZV90cmFpdHM+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgp0ZW1wbGF0ZTx0eXBlbmFtZS4uLlRzPgpzdHJ1Y3QgYXJlX3NhbWU7Cgp0ZW1wbGF0ZTx0eXBlbmFtZSBULCB0eXBlbmFtZSBVLCB0eXBlbmFtZS4uLlRzPgpzdHJ1Y3QgYXJlX3NhbWU8VCwgVSwgVHMuLi4+CnsKCXN0YXRpYyBjb25zdCBpbnQgdmFsdWUgPSBpc19zYW1lPFQsIFU+Ojp2YWx1ZSAmJiBhcmVfc2FtZTxVLCBUcy4uLj46OnZhbHVlOwp9OwoKdGVtcGxhdGU8dHlwZW5hbWUgVD4Kc3RydWN0IGFyZV9zYW1lPFQ+CnsKCXN0YXRpYyBjb25zdCBpbnQgdmFsdWUgPSAxOwp9OwoKaW50IG1haW4oKSAKewoJY291dCA8PCBhcmVfc2FtZTxpbnQsIGludCwgaW50LCBpbnQ+Ojp2YWx1ZSA8PCBlbmRsOwoJY291dCA8PCBhcmVfc2FtZTxpbnQsIGRvdWJsZSwgaW50LCBpbnQ+Ojp2YWx1ZSA8PCBlbmRsOwoJCgljb25kaXRpb25hbDxhcmVfc2FtZTxpbnQsIGludCwgZG91YmxlPjo6dmFsdWUsIGludCwgZG91YmxlPjo6dHlwZSBhOwoJCglyZXR1cm4gMDsKfQ==