c++11 - c++ typedef/type substitution for enumeration class -


as far aware @ moment not possible typedef of c++11 enum class. know if there other way can reduce length of name of variable enum when referring outside of encapsulating class. here example:

// along lines of: class segmentactivitystate; using segmentactivitytype = segmentactivitystate::activitystatetype;  // ...however, results in compile time error: // 'segmentactivitystate' not name type.   // enumeration class definition class segmentactivitystate { public:     enum class activitystatetype : index     {         preexecution = 0,   /**< pre-execution state. */         execution = 1, /**< execution state. */         postexecution = 2 /**< post-execution state. */     };  private:     activitystatetype activitystate;     /**< unique object identifier tag. */  public:     // ... methods work on activitystate } 

the important issue length of name have refer enum outside of segmentactivitytype. example, in order type comparison need write segmentactivity.getstate() == segmentactivitystate::activitystatetype::preexecution, verbose. 2 things prefer not are:

  1. typedef on segmentactivitystate.
  2. move enum classactivitystatetypeoutside of classsegmentactivitystate` definition.

your problem has nothing being enum. can't because you're trying access member of undefined class. never work no matter member is.

put typedef after class definition , will fine.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -