Bind a char to an enum type

后端 未结 3 1806
死守一世寂寞
死守一世寂寞 2021-02-20 15:44

I have a piece of code pretty similar to this:

class someclass
{
public:
enum Section{START,MID,END};
vector
Full; void ex(){ for(int i=0;i<
3条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-20 16:28

    I think the best solution in this case would be to use a map:

    #include 
    #include 
    class someclass
    {
        public:
        enum Section{START = 0,MID,END};
        map Full;
    
        // set using Full[START] = "S", etc
    
        void ex(){
            for(int i=0;i

提交回复
热议问题