c++ 20: how to find that the template argument is a rvalue reference
I want to pass a parameter to a function, do for, and if the argument is rvalue, then move objects instead of copying. How to do that? template<class T> void func(T&& v){ for (auto&& item : v) { if constexpr (std::is_rvalue_reference_v<T>) { // ALWAYS FALSE // move object auto tmp = std::move(item); } else {… Read More c++ 20: how to find that the template argument is a rvalue reference