title: Why does C++ mandate that complex only be instantiated for float, double, or long double?
body: <p>According to the C++ ISO spec, &sect;26.2/2:</p>
  
  <blockquote>
    <p>The effect of instantiating the template <code>complex</code> for any type other than <code>float</code>, <code>double</code> or <code>long double</code> is unspecified.</p>
  </blockquote>
  
  <p>Why would the standard authors explicitly add this restriction?  This makes it unspecified, for example, what happens if you make <code>complex&lt;int&gt;</code> or a <code>complex&lt;MyCustomFixedPointType&gt;</code> and seems like an artificial restriction.</p>
  
  <p>Is there a reason for this limitation?  Is there a workaround if you want to instantiate <code>complex</code> with your own custom type?</p>
  
  <p>I'm primarily asking this question because of <a href="https://stackoverflow.com/q/11108587/501557">this earlier question</a>, in which the OP was confused as to why <code>abs</code> was giving bizarre outputs for <code>complex&lt;int&gt;</code>.  That said, this still doesn't quite make sense given that we also might want to make <code>complex</code> numbers out of fixed-points types, higher-precision real numbers, etc.</p>