次のような列挙型クラスがあります。
typedef unsigned int binary_instructions_t;
enum class BinaryInstructions : binary_instructions_t
{
END_INSTRUCTION = 0x0,
RESET,
SET_STEP_TIME,
SET_STOP_TIME,
START,
ADD
};
そして、次のような switch ステートメントで列挙型のメンバーを使用しようとしています。
const std::string& function(binary_instructions_t arg, bool& error_detect)
{
switch(arg)
{
case (unsigned int)BinaryInstructions::END_INSTRUCTION:
return "end";
break;
}
translate_error = true;
return "ERROR";
}
(unsigned int)
基になる型が既に であるのに、なぜ へのキャストが必要なのunsigned int
ですか?