`std::decay` and perfect forwarding

Once again, @kerrek-sb explains how to correctly use std:decay when implementing perfect forwarding (both in C++11 and C++14) Here's the answer. I found myself in a similar situation. Namely, I was trying to implement a generic algorithm via tag dispatching. namespace detail { template<class Range>…

std::decay

std::decay returns the type of a parameter, as if that parameter was passed by value. Interesting interpretation. I always intended std::decay as a way to deduce the type resulting from array to pointer decay. But this is indeed limiting, as stated by cppreference: This is the type conversion…