|
callonce
1.0.0
Header-only memoized call-once wrapper for any C++ callable
|
Small, self-contained utility vocabulary types. More...
Namespaces | |
| detail | |
| Implementation details. Not part of the public API; do not use directly. | |
Classes | |
| class | single_threaded |
| Execution policy with no synchronisation overhead. The CTAD default. More... | |
| class | lock_free |
| Thread-safe, lock-free execution policy. More... | |
| class | memoized_invoke |
| Wraps a callable + argument set, runs it at most once, caches the result. More... | |
Functions | |
| template<typename F > | |
| memoized_invoke (F) -> memoized_invoke< single_threaded, F > | |
CTAD guide: a nullary callable deduces memoized_invoke<single_threaded, F>. More... | |
| template<typename F , typename... Args> | |
| requires (sizeof...(Args) > 0 &&std::is_invocable_v< F, Args... >) memoized_invoke(F | |
CTAD guide: a callable + arguments deduces single_threaded with decayed Args. More... | |
| template<typename ExecutionPolicy , typename F , typename... Args> | |
| requires std::is_invocable_v< F, Args... > auto | make_memoized (F &&func, Args &&... args) |
| Build a memoized_invoke with an explicit execution policy. More... | |
Small, self-contained utility vocabulary types.
| fedem::utility::memoized_invoke | ( | F | ) | -> memoized_invoke< single_threaded, F > |
CTAD guide: a nullary callable deduces memoized_invoke<single_threaded, F>.
| fedem::utility::requires | ( | sizeof... | Args, |
| 0 &&std::is_invocable_v< F, Args... > | |||
| ) |
CTAD guide: a callable + arguments deduces single_threaded with decayed Args.
| requires std::is_invocable_v< F, Args... > auto fedem::utility::make_memoized | ( | F && | func, |
| Args &&... | args | ||
| ) |
Build a memoized_invoke with an explicit execution policy.
CTAD always selects single_threaded, so this factory is the way to ask for lock_free (or a custom policy) while still letting F and Args be deduced.
| ExecutionPolicy | The policy to use — named explicitly. |
| func | The callable. Perfect-forwarded, then decayed and stored. |
| args | The arguments. Perfect-forwarded, then decayed and stored. |
memoized_invoke<ExecutionPolicy, std::decay_t<F>, std::decay_t<Args>...>.