Kristian Nielsen via developers <[email protected]> writes:
> Brandon Nesterenko <[email protected]> writes: >> + template <typename F> int >> + enable_master(F tranx_alloc); >> >> Why is this a template? Both implementations give lambdas with the same >> signatures. I'd think this would be clearer if the type was a >> function-pointer, or whatever C++ equivalent you want. > My understanding is that this is how you do function objects in C++. The Thinking more, that might be true in the general case; but here the passed-in lambdas have no captures. So in fact it _can_ be done without templates here, which is surely better. Like this: diff --git a/sql/semisync_master.cc b/sql/semisync_master.cc index 2372572e56c..77c8f5e5761 100644 --- a/sql/semisync_master.cc +++ b/sql/semisync_master.cc @@ -563,8 +563,8 @@ int Repl_semi_sync_master::init_object() } -template <typename F> int -Repl_semi_sync_master::enable_master(F tranx_alloc) +int +Repl_semi_sync_master::enable_master(Active_tranx * (*tranx_alloc)(mysql_mutex_t *, mysql_cond_t *, ulong)) So you're absolutely right, there's no need for the template here, it should be removed, thanks for the suggestion! - Kristian. _______________________________________________ developers mailing list -- [email protected] To unsubscribe send an email to [email protected]
