I usually work with complex data. When they changed the complex data class to use templates, they broke most of the code I had written until then. I was able to fix errors like in line 1 by making sure the constant was real, instead of an integer, as in line 2. An annoyance, but not too horrible.

At the time, I converted all my code to use complex<double> because that is essentially what the original complex had been, and have been using complex<double> since. I have a code that will need to work with very large data sets, so I need to use complex<float> instead. And now I get compile time errors for lines like 3 and 4. Is some way to allow a literal constant times a complex<float> to compile (without littering my code with a bunch of casts, like in line 5)?

I'm using MS Visual Studio 2008 Standard Edition, if there's some compiler-specific flag that will fix this.

Code:
#include <complex>

using namespace std;

int dumdum(const complex<float> &cf, const complex<double> &cd)
{
  complex<double> cd0;
  complex<float> cf0;

  cd0 = 2 * cd;    //  1. Error.  Easy work-around: use 2.0
  cd0 = 2.0 * cd;  //  2. No error.
  cf0 = 3.0 * cf;  //  3. An error?  Are you kidding me????
  cf0 = cf * 3.0;  //  4. Still an error.
  cf0 = cf * (float)3.0;  //  5. Kludge.  And ugly.

  return 0;
}