Scoped Function Caller

We have Scoped Value Setter, why not a little class which calls a user-supplied function in its destructor?

I think what you’re after is ScopeGuard, also if you need to store them in a container check out ErasedScopeGuard

https://docs.juce.com/master/structScopeGuard.html

5 Likes

Nailed it.

In that case my new feature request is fuzzier searching in the class index… I searched for ā€˜scoped’!

Thanks!

If you’re on Windows/Linux there is this, not sure how well it works. The macOS commercial software is reasonably good, but it’s a sodding subscription model now which I will not be bothering with once my 2 year grace period expires as the one docset I mainly use (JUCE) is not part of the official ones and the docset available from @modosc hasn’t been updated in a while (which is fair enough, I could always fix that myself).

fwiw I just tried a search for ā€œscopedā€ in Dash and ScopeGuard ended up being a long way down the results list. The other annoying thing is the inherited methods/members accordions will not expand in Dash. The Dash author told me it’s a problem the docset author needs to fix! :person_shrugging:

i haven’t been updating it lately because dash’s subscription model is annoying enough that i don’t feel like doing free work for them anymore.

that being said, anyone can fork my repo (or take it over, i’m happy to transfer) if they want to keep publishing.

the docset build just comes from juce’s Doxyfile with a few QOL changes changes. if there’s an option that does what you describe lmk and i’m happy to try it.

1 Like

Yeah I fully understand that position. As soon as my grace period is up I’ll not subscribe. A proper cross-platform FOSS alternative would be great, I’ll add it to my list of never-to-be-completed "things I want to build"™… :joy: