I wonder what the correct way to use a perfect redirected functor? Here are two pieces of code. Which one is the best, and if not, what is the best form?
template<typename T, typename... Args>
void callMe(T&& func, Args&&... args) {
func(std::forward<Args>(args)...);
}
or
template<typename T, typename... Args>
void callMe(T&& func, Args&&... args) {
std::forward<T>(func)(std::forward<Args>(args)...);
}
EDIT:
Will this affect overload resolution? If it func operator()has a ref-qualifier for &&or const &, should I use the latest version and should I worry about what overload I'm causing?
Thank!
source
share