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);
Printable View
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);
if uint_64 is a valid typedef then the code is legal.
You are only assigning the value of x to y (you are also doing an unecessary explicit cast).
It is just like writing:
LaitinenCode:int x = 123;
int y = x;
This is legal although it does not mean those types have a constructor. This syntax helps in template metaprogramming.