Last active
April 1, 2020 15:29
-
-
Save uwanosorauepon/b7767df4d5824b12c3a3ae6e1cec332f to your computer and use it in GitHub Desktop.
[C++] charを任意の文字型に変換する(コンパイル時)
This file contains hidden or 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
// charを他の文字型に変換する | |
// T: (char|wchar_t|char8_t|char16_t|char32_t) | |
template <typename T> | |
constexpr T Convert(char c) | |
{ | |
// リトルエンディアン、ビッグエンディアン関係なくこれで良さそう。 | |
return static_cast<T>(c); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment