Daily bit(e) of C++ | std::declval
Daily bit(e) of C++ #394, Utility for obtaining lvalue reference to types that cannot be default constructed: std::declval.
When implementing generic code that relies on decltype, you can run into a problem.
If a type cannot be default constructed, we won't be able to spell an instantiation of that type within an expression.
Using std::declval, we can obtain an lvalue reference without creating a value.
Note that std::declval can only be used in unevaluated contexts (e.g. decltype).