#include <iostream>
#include <typeinfo>
using namespace std;
template<typename FalseType, typename TrueType, bool condition>
struct ConditionalTypeSelector
{
typedef void ResultType;
};
template<typename FalseType, typename TrueType>
struct ConditionalTypeSelector<FalseType,TrueType,false>
{
typedef FalseType ResultType;
};
template<typename FalseType, typename TrueType>
struct ConditionalTypeSelector<FalseType,TrueType,true>
{
typedef TrueType ResultType;
};
struct A {
unsigned char member;
};
struct B {
int member;
};
struct C {
long long member;
};
int main() {
cout << typeid
( ConditionalTypeSelector
< A,B,(sizeof(A) > sizeof(B))
>::ResultType
).name() << endl;
cout << typeid
( ConditionalTypeSelector
< A,B,(sizeof(B) > sizeof(A))
>::ResultType
).name() << endl;
cout << typeid
( ConditionalTypeSelector
< A,C,(sizeof(A) > sizeof(C))
>::ResultType
).name() << endl;
cout << typeid
( ConditionalTypeSelector
< C,B,true>::ResultType
).name() << endl;
cout << typeid
( ConditionalTypeSelector
< C,A,false>::ResultType
).name() << endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dHlwZWluZm8+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdGVtcGxhdGU8dHlwZW5hbWUgRmFsc2VUeXBlLCB0eXBlbmFtZSBUcnVlVHlwZSwgYm9vbCBjb25kaXRpb24+CnN0cnVjdCBDb25kaXRpb25hbFR5cGVTZWxlY3Rvcgp7CiAgICB0eXBlZGVmIHZvaWQgUmVzdWx0VHlwZTsKfTsKCnRlbXBsYXRlPHR5cGVuYW1lIEZhbHNlVHlwZSwgdHlwZW5hbWUgVHJ1ZVR5cGU+CnN0cnVjdCBDb25kaXRpb25hbFR5cGVTZWxlY3RvcjxGYWxzZVR5cGUsVHJ1ZVR5cGUsZmFsc2U+CnsKICAgIHR5cGVkZWYgRmFsc2VUeXBlIFJlc3VsdFR5cGU7Cn07Cgp0ZW1wbGF0ZTx0eXBlbmFtZSBGYWxzZVR5cGUsIHR5cGVuYW1lIFRydWVUeXBlPgpzdHJ1Y3QgQ29uZGl0aW9uYWxUeXBlU2VsZWN0b3I8RmFsc2VUeXBlLFRydWVUeXBlLHRydWU+CnsKICAgIHR5cGVkZWYgVHJ1ZVR5cGUgUmVzdWx0VHlwZTsKfTsKCnN0cnVjdCBBIHsKICAgIHVuc2lnbmVkIGNoYXIgbWVtYmVyOwp9OwoKc3RydWN0IEIgewogICAgaW50IG1lbWJlcjsKfTsKCnN0cnVjdCBDIHsKICAgIGxvbmcgbG9uZyBtZW1iZXI7Cn07CgppbnQgbWFpbigpIHsKICAgIGNvdXQgPDwgdHlwZWlkCiAgICAgICAgICAgICAgICAoIENvbmRpdGlvbmFsVHlwZVNlbGVjdG9yCiAgICAgICAgICAgICAgICAgICAgICA8IEEsQiwoc2l6ZW9mKEEpID4gc2l6ZW9mKEIpKQogICAgICAgICAgICAgICAgICAgICAgPjo6UmVzdWx0VHlwZQogICAgICAgICAgICAgICAgKS5uYW1lKCkgPDwgZW5kbDsKICAgIGNvdXQgPDwgdHlwZWlkCiAgICAgICAgICAgICAgICAoIENvbmRpdGlvbmFsVHlwZVNlbGVjdG9yCiAgICAgICAgICAgICAgICAgICAgICA8IEEsQiwoc2l6ZW9mKEIpID4gc2l6ZW9mKEEpKQogICAgICAgICAgICAgICAgICAgICAgPjo6UmVzdWx0VHlwZQogICAgICAgICAgICAgICAgKS5uYW1lKCkgPDwgZW5kbDsKCiAgICBjb3V0IDw8IHR5cGVpZAogICAgICAgICAgICAgICAgKCBDb25kaXRpb25hbFR5cGVTZWxlY3RvcgogICAgICAgICAgICAgICAgICAgICAgPCBBLEMsKHNpemVvZihBKSA+IHNpemVvZihDKSkKICAgICAgICAgICAgICAgICAgICAgID46OlJlc3VsdFR5cGUKICAgICAgICAgICAgICAgICkubmFtZSgpIDw8IGVuZGw7CgogICAgY291dCA8PCB0eXBlaWQKICAgICAgICAgICAgICAgICggQ29uZGl0aW9uYWxUeXBlU2VsZWN0b3IKICAgICAgICAgICAgICAgICAgICAgIDwgQyxCLHRydWU+OjpSZXN1bHRUeXBlCiAgICAgICAgICAgICAgICApLm5hbWUoKSA8PCBlbmRsOwoKICAgIGNvdXQgPDwgdHlwZWlkCiAgICAgICAgICAgICAgICAoIENvbmRpdGlvbmFsVHlwZVNlbGVjdG9yCiAgICAgICAgICAgICAgICAgICAgICA8IEMsQSxmYWxzZT46OlJlc3VsdFR5cGUKICAgICAgICAgICAgICAgICkubmFtZSgpIDw8IGVuZGw7CgogICAgcmV0dXJuIDA7Cn0K