Aliasing of Types, Variables, and Functions
Create an alias with using, for:
- Member variable alias
class Vector3<type T> : Vector<3, T> { using var x = data[0] using Int y = data[1] using T z = data[2] }- Not quite possible in C++.
- With
T& z = data[2], unfortunately, memory is created for the reference (the pointer). - And this indeed is necessary here, because the reference could be assigned differently in the constructor, so it is not possible to optimize it away.
- With
- Not quite possible in C++.
- Member function alias
class A : B { using func f(String) = g(String) using func f = g }using func f(String) = g(String)to alias the functiong(String).using func f = gto alias all overloads of the functiong.
- Type alias in a class
class String { using InParameterType = const StringView }- (No
.)typedef
- (No