lately I've seen some code with functions labeled like this:
auto Function(...) -> BOOL
Is there some difference between using just
BOOL Function(...)
The first one looks nicer to me though, maybe I'm just weird, so is it just visual, or it has some other benefits?
Is there some difference between using just [...]
No - in your particular example, they are equivalent.
it just visual, or it has some other benefits?
Trailing return types have a few benefits:
Easier to switch to automatic return type deduction in the future (just delete everything after ->
)
Can use parameters as part of the return type
Can access class C
type aliases without having to say C::
In your particular example, these do not apply.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With