Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Enum Class Comparisons
//Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23506 for x64 #include <iostream> #include <type_traits> enum class TypeA : uint32_t { First, Second }; enum class TypeB : uint64_t { First, Second }; int main() { // This won't assert static_assert(std::underlying_type_t<TypeA>(TypeA::First) == std::underlying_type_t<TypeB>(TypeB::First), ""); // This also won't assert static_assert(TypeA::First == TypeA(TypeB::First), ""); std::cout << "Hello, world!\n"; }
run
|
edit
|
history
|
help
0
#8
hangman
ExtThes_Uniquify
Union and possible undefined behavior
return reference (msvc)
Regex pipe and tabs c++
Computing the factorial of an integer using factorial and iteration
Not an overflow
constmsvc
Static cast of Enum