So, I have this templatized function (which I know is ugly to look at.)
My intention was not to default the template parameter though, my intention was to create a typename
derived from T
that could be used in caster
that the user could not assign to.
My question is how do I create a typename
for a templatized function which the user cannot pass as an argument?
As an example:
template <typename T>
typename R = std::conditional<sizeof(T) == 4, char, short>;
R foo(T bar){return R(bar);}
Clearly this code doesn't compile, but that's the behavior I'd like to accomplish. Is a functor the only way to do this?