specify default value of std::function March 20, 2023 by Tarik void func(const std::function<void()>& f = {}) { if(f) f(); } LIVE DEMO