«strongly-typed-enum» 태그된 질문

11
강력한 형식의 열거 형을 int로 자동 변환하는 방법은 무엇입니까?
#include <iostream> struct a { enum LOCAL_A { A1, A2 }; }; enum class b { B1, B2 }; int foo(int input) { return input; } int main(void) { std::cout << foo(a::A1) << std::endl; std::cout << foo(static_cast<int>(b::B2)) << std::endl; } 그만큼 a::LOCAL_A 강력한 형식의 열거 형이 달성하려고하는 것이지만 약간의 차이가 …
당사 사이트를 사용함과 동시에 당사의 쿠키 정책개인정보 보호정책을 읽고 이해하였음을 인정하는 것으로 간주합니다.
Licensed under cc by-sa 3.0 with attribution required.