One option would be to write :
#define function auto
Then people could write :
function foo(int x, int y) -> int;
(No, I do /not/ recommend that!)
A not uncommon complaint about the syntax of C and C++ is that there is
no keyword that says this is the start of a function definition, as
there is in most languages - this would let you pretend there is one.
I sometimes use "auto" for functions, but then I do not have a trailing
return type - return type deduction is simpler and clearer:
template<typename TL, typename TR>
auto Add(const TL& lhs, const TR& rhs) {
return lhs + rhs;
}
I think it is rare that a decltype trailing return type actually makes
anything clearer in the code - it just adds more scope for error. And I
see no purpose at all in putting "auto" at the start of the function
declaration and an explicit type at the end. Putting "auto", or a
concept, as the return type is a clear indication that you do not have
(or want to give) an explicit return type here but want the compiler to
figure it out. That's what "auto" means in C++. It seems
counter-productive to me to say "the compiler will figure this out" at
the start of the declaration, then do the compiler's job at the end of
the declaration.