I would like some way to evaluate a switch-class statement using class members that are not integer or eum.

The real question is how to make those class members `const-expression` i.e. those members must be known as constant at compile-time.

I tried the code below with `static const`, but it works only when in the `case` statements there are integers.

I was looking at new `C++11 constexpr` that would do the job.

What If I have not available that keyword? Is there anyway or trick or anything to allow my class members (non integer or enum) being const expressions?

I am using Linux and g++. Also any g++ specific keyword would be appreciated.

```
  class MyEnum
  {
  public:
    int val_;
    MyEnum(){}
    MyEnum(int v): val_(v){}
    operator int(){return val_;}
    static const MyEnum ALFA;
    static const MyEnum BETA;
    void foo() {
       // do something.
    }
  };

  const MyEnum MyEnum::ALFA(1);
  const MyEnum MyEnum::BETA(2);

  void testEnum()
  {
    MyEnum val = MyEnum::ALFA;

    switch(val)
    {
      case 0: //works
      //case MyEnum::ALFA:// doesn't work
      cout << "ciao" << endl;
      break;
      case 1: //works
      //case MyEnum::BETA: // doesn't work
      cout << "bello" << endl;
      break;
      default:
      break;
    } 
  }

```