using
Declarations
You may use a using
declarations to import names either from a namespace or from a base class in a derived class definition.
The using
keyword introduces a name that is defined elsewhere into the declarative region where this using-declaration appears.
using
Declarations to Define Types, Alias Templates and Function Types
First, instead of
typedef unsigned char uc;
you may just code:
using uc = unsigned char;
An alias template extends the power of templates, is explained elsewhere, and it enables writing powerful code like:
template <typename T> using my_vector_t = std::vector<T, custom_allocator<T>>;
where template classcustom_allocator<>
must have been defined.
Finally, you can use using
to declare the type of functions or pointers to functions, as in
using fn = void(byte, double); void func(byte b, double d) { /*...*/ } fn* f = func;