When template metaprogramming in C++, I often run into something like the following:
template <typename T>
S<T> make_wrapper(T&& t) { return S<T>(std::forward<T>(t)); }
I know I should use something like std::decay
in the return type, but why wouldn't std::remove_reference
work as well? What's the difference here? What about std::remove_cvref
?
Aucun commentaire:
Enregistrer un commentaire