C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Return type of function available inside function

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Tue, 24 Jan 2023 22:13:27 +0000
On Tue, Jan 24, 2023 at 9:29 PM Oleksandr Koval
<oleksandr.koval.dev_at_[hidden]> wrote:

> In:
> auto Func2(double a, int b)
> {
> return_t obj; // #1
> return a + b; // # 2
> }
>
> the compiler can't know the return type at #1 because it becomes clear only at #2.


How's that any different from the following?

struct Monkey {
    int Jump(void) { return jumpiness; }
    int jumpiness;
};

Received on 2023-01-24 22:13:39