4

Often people std::forward a callable object before calling it like this (example):

template <typename F, typename ...Args>
void call(F &&f, Args &&...args)
{
    std::forward<F>(f) ( // <<< -- question
        std::forward<Args>(args)...  
    );
}

What's the benefit of std::forward-ing f in the example above compared to simple f(std::forward<Args>(args)...?

Dev Null
  • 4,731
  • 1
  • 30
  • 46

0 Answers0