title: Multiplying complex with constant in C++
body: <p>The following code fails to compile</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cmath&gt;
  #include &lt;complex&gt;
  
  using namespace std;
  
  int main(void)
  {
      const double b=3;
      complex &lt;double&gt; i(0, 1), comp;
  
      comp = b*i;
  
      comp = 3*i;
  
      return 0;
  }
  </code></pre>
  
  <p>with
      error: no match for ‘operator*’ in ‘3 * i’
  What is wrong here, why cannot I multiply with immediate constants? b*i works.</p>