title: if / else at compile time in C++?
body: <p>Consider the following code :</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;type_traits&gt;
  
  template&lt;typename T&gt; class MyClass
  {
      public:
          MyClass() : myVar{0} {;}
          void testIf() {
              if (isconst) {
                  myVar;
              } else {
                  myVar = 3;
              }
          }
          void testTernary() {
              (isconst) ? (myVar) : (myVar = 3);
          }
  
      protected:
          static const bool isconst = std::is_const&lt;T&gt;::value;
          T myVar;
  };
  
  int main()
  {
      MyClass&lt;double&gt; x;
      MyClass&lt;const double&gt; y;
      x.testIf();
      x.testTernary();
      y.testIf(); // &lt;- ERROR
      y.testTernary(); // &lt;- ERROR
      return 0;
  }
  </code></pre>
  
  <p>For x (non-const) there is no problem. But y (const data type) cause an error even if the condition in if/else is known at compile-time.</p>
  
  <p>Is there any possibility to not compile the false condition at compile-time ?</p>