The second line looks like a constructor! But Time is nothing more than a build-in type. Is this legal and why?Code:typedef uint_64 Time; Time x = 123; Time y = Time(x);
The second line looks like a constructor! But Time is nothing more than a build-in type. Is this legal and why?Code:typedef uint_64 Time; Time x = 123; Time y = Time(x);
it's perfectly legal - but just remember that the ctor for built-in types must be called explicitly. in other words:
Code:char c; // uninitialized - contains junk. int i = int(); // initialized to 0.
Code:#include <cmath> #include <complex> bool euler_flip(bool value) { return std::pow ( std::complex<float>(std::exp(1.0)), std::complex<float>(0, 1) * std::complex<float>(std::atan(1.0) *(1 << (value + 2))) ).real() < 0; }