The simplest version:
void set(std::function<function_type> f) {
func_ = std::move(f);
}
Integrated version:
template <class F,
class = std::enable_if_t<std::is_assignable<std::function<function_type>&, F&&>::value>
>
void set(F&& f) {
func_ = std::forward<F>(f);
}
. , , std::function , , , , .