static bool is_empty_function(F const& f) noexcept { using is_pointer = std::integral_constant<bool, std::is_pointer<F>::value || std::is_member_pointer<F>::value >; return is_empty_function(is_pointer{}, f); }
static bool is_empty_function(F const& f) noexcept { std::integral_constant<bool, std::is_pointer<F>::value || std::is_member_pointer<F>::value > is_pointer; return is_empty_function(f, is_pointer); }
void assign(F&& f) { if (!is_empty_function(f)) { typedef typename util::decay<F>::type target_type; VTablePtr const* f_vptr = get_table_ptr<target_type>(); if (vptr == f_vptr) { vtable::reconstruct<target_type>(&object, std::forward<F>(f)); } else { reset(); vtable::destruct<empty_function<Sig> >(&this->object); vptr = f_vptr; vtable::construct<target_type>(&object, std::forward<F>(f)); } } else { reset(); } }
void assign(F&& f) { if (!is_empty_function(f)) { typedef typename std::decay<F>::type target_type; VTable const* f_vptr = get_vtable<target_type>(); if (vptr == f_vptr) { vtable::reconstruct<target_type>(object, std::forward<F>(f)); } else { reset(); vtable::_delete<empty_function<R(Ts...)> >(object); vptr = f_vptr; vtable::construct<target_type>(object, std::forward<F>(f)); } } else { reset(); } }