Date: Mon, 17 Apr 2023 09:19:22 -0500
On Monday, 17 April 2023 06:25:05 CDT Frederick Virchanza Gotham via Std-
Proposals wrote:
> Also if we had a boolean to say whether or not the current invocation
> is a recursive call, i.e.:
>
> namespace std {
> bool is_recursive_call(void) noexcept;
> }
This is simple to implement:
Just declare a function-static-thread-local variable that you increment on on
scope entry and decrement on scope exit. At any moment when it's not 1, it's
being recursed.
But the cost of that for each function is pretty high, so it needs to be opt-
in.
Proposals wrote:
> Also if we had a boolean to say whether or not the current invocation
> is a recursive call, i.e.:
>
> namespace std {
> bool is_recursive_call(void) noexcept;
> }
This is simple to implement:
Just declare a function-static-thread-local variable that you increment on on
scope entry and decrement on scope exit. At any moment when it's not 1, it's
being recursed.
But the cost of that for each function is pretty high, so it needs to be opt-
in.
-- Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org Software Architect - Intel DCAI Cloud Engineering
Received on 2023-04-17 14:19:24