LoginSignup
5
6

More than 5 years have passed since last update.

【Cocos2dx、c++】enumのインクリメント

Posted at

以下の様なenumの時

enum kStatus{
  kStatusNone = 0,
  kStatus0,
  kStatus1,
  kStatus2,
  kStatusCount
};
kStatus currentStatus = kStatusNone;

このcurrentStatusをインクリメントする場合

this->currentStatus++;

だと怒られるので以下で。

this->currentStatus = static_cast<kStatus>(this->currentStatus + 1);

もっといい方法あるかな。

5
6
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
6