Yes, you can define an operator ...
Adjust_mode operator+(Adjust_mode lhs, int rhs)
{
return static_cast<Adjust_mode>(
(static_cast<int>(lhs) + rhs) % 7);
}
Adjust_mode operator+(int lhs, Adjust_mode rhs)
{
return static_cast<Adjust_mode>(
(lhs + static_cast<int>(rhs)) % 7);
}
Note that you need both to let adjust_mode_ + 1 and 1 + adjust_mode_ work. If you provide only one function operator+(Adjust_mode, Adjust_mode), then the above expression instead converts enum to int and returns the result of int.
, , , .