A namespace alias is a convenient way of referring to a long namespace name by a different, shorter name.
As an example, say you wanted to use the numeric vectors from Boost's uBLAS without a using namespace
directive. Stating the full namespace every time is cumbersome:
boost::numeric::ublas::vector<double> v;
Instead, you can define an alias for boost::numeric::ublas
-- say we want to abbreviate this to just ublas
:
namespace ublas = boost::numeric::ublas;
ublas::vector<double> v;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…