Created
May 18, 2016 00:44
-
-
Save joshuashaffer/bb722331bf3047031cfcc0b5fda3c89b to your computer and use it in GitHub Desktop.
Const cast without specifing type...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <typename T> | |
constexpr T& const_cast_t(const T& p) { | |
using pctype = std::remove_const_t<T>; | |
return const_cast<pctype&>(p); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment