For template functions I use perfect forwarding like this:
template<typename T>
void f (T && v)
{
g (std::forward<T> (v));
}
How do I perfect forward auto &&
parameters in C++14
lambda expressions?
auto f = [] (auto && v)
{
g (std::forward<??> (v));
};
(Tried to google for it but didn't get any good hits on the keywords I picked)
Yes, they can be perfect-forwarded by means of
decltype()
specifier:DEMO