template <typename T> class property {
T value;
public:
T & operator = (const T &i) {
return value = i;
}
operator T const & () const {
return value;
}
};
struct Bar {
// Using the property<>-template.
property <bool> alpha;
property <unsigned int> bravo;
};
int main () {
Bar bar;
bar.alpha = true;
return bar.bravo;
}
ICAgCiAgICB0ZW1wbGF0ZSA8dHlwZW5hbWUgVD4gY2xhc3MgcHJvcGVydHkgewogICAgICAgICAgICBUIHZhbHVlOwogICAgICAgIHB1YmxpYzoKICAgICAgICAgICAgVCAmIG9wZXJhdG9yID0gKGNvbnN0IFQgJmkpIHsKICAgICAgICAgICAgICAgIHJldHVybiB2YWx1ZSA9IGk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAKICAgICAgICAgICAgb3BlcmF0b3IgVCBjb25zdCAmICgpIGNvbnN0IHsKICAgICAgICAgICAgICAgIHJldHVybiB2YWx1ZTsKICAgICAgICAgICAgfQogICAgfTsKICAgICAKIAogICAgc3RydWN0IEJhciB7CiAgICAgICAgLy8gVXNpbmcgdGhlIHByb3BlcnR5PD4tdGVtcGxhdGUuCiAgICAgICAgcHJvcGVydHkgPGJvb2w+IGFscGhhOwogICAgICAgIHByb3BlcnR5IDx1bnNpZ25lZCBpbnQ+IGJyYXZvOwogICAgfTsKICAgICAKICAgIGludCBtYWluICgpIHsKICAgICAgICBCYXIgYmFyOwogICAgICAgIGJhci5hbHBoYSA9IHRydWU7CiAgICAgICAgCiAgICAgICAgcmV0dXJuIGJhci5icmF2bzsKICAgIH0K