I don’t know why use this using i64 = long long;
in C++ contest.
What’s the reason behind using this?
I don’t know why use this using i64 = long long;
in C++ contest.
What’s the reason behind using this?
The line
using i64 = long long;
creates a type alias for the integer type long long
that is called i64
.
However, this alias implies that long long
would be a 64-bit integer, which is not precise. The standard requires long long
to be at least 64 bits, if you need exactly 64 bits, use the fixed width integer type int64_t
.
This is a type alias
. From the cpp-reference:
A type alias declaration introduces a name which can be used as a synonym for the type denoted by type-id. It does not introduce a new type and it cannot change the meaning of an existing type name.
The line
using i64 = long long;
implies that i64
maybe used to refer to the type long long
proceeding the using
statement within the scope.
However, as @churill's answer clarifies, in this case, using i64
as an alias for long long
is misleading and should be avoided.
You just give a name for "long long" type. In your program every "i64" are simply being replaced by "long long" type. You can use "long long" instead of "i64" and there will be no difference.