You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am very interested in the implementation of the algorithm factory in this framework.It's a wonderfull idea to use templates.Now, I have a doubt about the function Register in class AlgorithmRegister(as you see below),
template <int... Is>
voidRegister(std::string algorithm_name, int_sequence<Is...>) {
auto function = std::bind(&AlgorithmRegister<AlgorithmBase, Algorithm, Args...>::create,
std::placeholder_template<Is>{}...);
AlgorithmFactory<AlgorithmBase, Args...>::Register(algorithm_name, function);
}
Instead of passing the function create directly, it uses bind to wrap it. Such practice leads to a dependency on int_sequence and placeholder_template, making the code complicated. So I rewrite it as follow:
I am very interested in the implementation of the algorithm factory in this framework.It's a wonderfull idea to use templates.Now, I have a doubt about the function
Register
in classAlgorithmRegister
(as you see below),Instead of passing the function
create
directly, it uses bind to wrap it. Such practice leads to a dependency onint_sequence
andplaceholder_template
, making the code complicated. So I rewrite it as follow:Would it be better choice?How did the engineer consider it at that time?
The text was updated successfully, but these errors were encountered: