Condition in Template Definition

Viewed 138

I want to change the return type of a template function depending on a property of the given type. Is there a possibility to do something like this, maybe with partial specialization (one for the cool T and one for not cool ones)?

template<typename T, typename ret = T::IsCool ? int : float>
inline ret get() {}

(It is always guaranteed, that T has the bool property IsCool.)

1 Answers
Related