The only reason I see is that it will let you indicate that you are done() , then do more work (like cleaning) that you don't want your consumer to have to wait.
Now they could do this:
private: void agent::do_run() { run(); if (status() != agent_done) done(); }
then their do_run() -frame call do_run() instead of run() directly (or the equivalent).
However, you will notice that you can do it yourself.
class myagent: public agent { protected: virtual void run() final override { } virtual void do_run() = 0; };
and poof, if your do_run() cannot call done() , the wrapping function will do it for you. If this second overhead utility function is too high for you:
template<typename T> class myagent: public agent { private: void call_do_run() { static_cast<T*>(this)->do_run(); } protected: virtual void run() final override { } };
CRTP, which allows sending at compile time. Using:
class foo: public myagent<foo> { public: void do_run() { } };
... / shrug
source share