Since C++11, type aliases can be declared via using
or typedef
. using
should be preferred as more readable
because you see the new name/alias first.
In addition, using
can be templated, which makes it applicable to more situations than typedef
.
Noncompliant code example
typedef void (*FunctionPointerType)(int);
Compliant solution
using FunctionPointerType = void (*)(int);