// in the normal case, just the identity
template<class T>
struct item_return{ typedef T type; };
template<class T>
typename item_return<T>::type foo(){ return T(); }
template<>
struct item_return<float>{ typedef int type; };
template<>
int foo<float>(){ return 42; }
// might want to stick to the following
// so you only need to update the return-type in one place
// namely, the `item_return` specialization
//template<>
//item_return<float>::type foo<float>(){ ... }
// note: No `typename` needed, because `float` is not a dependent type
int main(){
}
Ly8gaW4gdGhlIG5vcm1hbCBjYXNlLCBqdXN0IHRoZSBpZGVudGl0eQp0ZW1wbGF0ZTxjbGFzcyBUPgpzdHJ1Y3QgaXRlbV9yZXR1cm57IHR5cGVkZWYgVCB0eXBlOyB9OwoKdGVtcGxhdGU8Y2xhc3MgVD4KdHlwZW5hbWUgaXRlbV9yZXR1cm48VD46OnR5cGUgZm9vKCl7IHJldHVybiBUKCk7IH0KCnRlbXBsYXRlPD4Kc3RydWN0IGl0ZW1fcmV0dXJuPGZsb2F0PnsgdHlwZWRlZiBpbnQgdHlwZTsgfTsKCnRlbXBsYXRlPD4KaW50IGZvbzxmbG9hdD4oKXsgcmV0dXJuIDQyOyB9CgovLyBtaWdodCB3YW50IHRvIHN0aWNrIHRvIHRoZSBmb2xsb3dpbmcKLy8gc28geW91IG9ubHkgbmVlZCB0byB1cGRhdGUgdGhlIHJldHVybi10eXBlIGluIG9uZSBwbGFjZQovLyBuYW1lbHksIHRoZSBgaXRlbV9yZXR1cm5gIHNwZWNpYWxpemF0aW9uCi8vdGVtcGxhdGU8PgovL2l0ZW1fcmV0dXJuPGZsb2F0Pjo6dHlwZSBmb288ZmxvYXQ+KCl7IC4uLiB9Ci8vIG5vdGU6IE5vIGB0eXBlbmFtZWAgbmVlZGVkLCBiZWNhdXNlIGBmbG9hdGAgaXMgbm90IGEgZGVwZW5kZW50IHR5cGUKCmludCBtYWluKCl7Cn0=