title: c++ enable, disable class member functions?
body: <p>Is it possible to enable, disable class member functions?</p>
  
  <p>Situation:
  I have a class with 2 types. Each Type has a own constructor. One Type need a function which must not have the other Type.</p>
  
  <p>Example:</p>
  
  <pre><code>class A {
      enum struct TypeEnum : int {
          TYPE_1 = 1,
          TYPE_2 = 2
      };
      const TypeEnum type;
  
      int x;
  
  
      A(void) : type(TypeEnum::TYPE_1) { }
      A(int _x) : type(TypeEnum::TYPE_2) { 
          x = _x;
      }
  
  
      // function only for Type 2
      void A::operator += (const int&amp; n) {
          x = x + n;
      }
  };
  
  int main() {
      A test1 = new A();
      A test2 = new A(1);
  
      test1 += 5;  // compiler error should be here
      test2 += 5;  // OK
  
      return 0;
  }
  </code></pre>
  
  <p>Is where something possible like this:</p>
  
  <pre><code>class A {
      enum struct TypeEnum : int {
          TYPE_1 = 1,
          TYPE_2 = 2
      };
      const TypeEnum type;
  
      int x;
  
  
      A(void) : type(TypeEnum::TYPE_1) { }
      A(int _x) : type(TypeEnum::TYPE_2) { 
          x = _x;
      }
  
  
      // Is somethig like this realy impossible
      void A::operator += (const int&amp; n) -&gt; enable_if(type == TypeEnum::Type2) { // if not compile error
          x = x + n;
      }
  };
  </code></pre>