generated from bemanproject/exemplar
-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
Look at the comment in this review an consider making a cancel policy
Getting back to the review here. So I think what you're suggesting is something like this:
class always_active_policy
{
bool is_enabled() { return true; }
};
class cancel_policy
{
bool enabled = true;
bool is_enabled() { return enabled; }
void disable() { enabled = false; };
void enable() { enabled = true; };
}
template<class EF, class cancellation_policy = always_active_policy>
class scope_success : public cancellation_policy
{}
At which point the user can inject any name they'd like or omit the capability altogether. The later of which seems like the most likely case -- that is never enable/disable.
I think that's an improvement worthy of making - it's just size of bool, but for embedded if this was used extensively it's more not paying for what you don't use.
Note that this might be just a tad more complicated in that maybe this policy goes into the InvokeChecker so it has to be a template template parameter
Originally posted by @JeffGarland in #20 (comment)
Metadata
Metadata
Assignees
Labels
No labels