Yes, this is a valid code. This is necessary when you have template functions so that you can use a single code. For example,
template<typename T, typename P> T f(int x, P y) { return g(x, y); }
Now g can be overloaded to return void when the second argument is a specific type. If "return void" is invalid, the call to f will be interrupted.
zvrba Aug 01 '10 at 17:53 2010-08-01 17:53
source share