So I have a perfect forwarder, and I want to appropriately capture it in a lambda, such that R-values are copied in, and L-values are captured by reference. However simply
You may use the following:
[test = std::conditional_t< std::is_lvalue_reference<T>::value, std::reference_wrapper<std::remove_reference_t<T>>, T>{std::forward<T>(t)}]
Live Demo
but providing helper function seems more readable